Camel Direct 端点异常
Camel Direct end-point exception
我有一个简单的问题。我无法从文件端点读取到直接端点。下面是代码片段:
public class SampleTwo {
public static void main(String[] args) throws Exception {
final CamelContext camelContext = new DefaultCamelContext();
camelContext.start();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file://target/inbox?noop=true&fileName=test.csv").to("direct://start"); //Fails with "No consumers available on endpoint" exception
//from("file://target/inbox?noop=true&fileName=test.csv").to("file://target/outbox"); //Works
}
});
Thread.sleep(1000*6000);
// stop the CamelContext
// camelContext.stop();
}}
我遇到异常 "No consumers available on endpoint"。这是一个简单的路由 & 我已经做了我能做的一切 - 现在花了 10 多个小时:(
请帮助...跟踪堆栈跟踪(启用跟踪)
[hread #0 - file://target/inbox] EventHelper
TRACE Notifier: org.apache.camel.impl.DefaultRuntimeEndpointRegistry@99e74a is not enabled for the event: ID-01HW466539-57567-1431438054047-0-41 exchange failure: Exchange[test.csv]
cause
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
[hread #0 - file://target/inbox] FileConsumer
TRACE Done processing file: GenericFile[test.csv] synchronously
[hread #0 - file://target/inbox] DefaultErrorHandler
ERROR Failed delivery for (MessageId: ID-01HW466539-57567-1431438054047-0-42 on ExchangeId: ID-01HW466539-57567-1431438054047-0-41). Exhausted after delivery attempt:
1 caught:
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
消息历史记录
--------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [file://target/inbox?fileName=test.csv&noop=true ] [ 3]
[route1 ] [to1 ] [direct://start ] [ 0]
交换
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id ID-01HW466539-57567-1431438054047-0-41
ExchangePattern InOnly
Headers {breadcrumbId=ID-01HW466539-57567-1431438054047-0-42, CamelFileAbsolute=false, CamelFileAbsolutePath=C:\folder\eclipse-ws-march\camelsampletwo\target\inbox\test.csv, CamelFileContentType=null, CamelFileLastModified=1431426831841, CamelFileLength=45, CamelFileName=test.csv, CamelFileNameConsumed=test.csv, CamelFileNameOnly=test.csv, CamelFileParent=target\inbox, CamelFilePath=target\inbox\test.csv, CamelFileRelativePath=test.csv, CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType org.apache.camel.component.file.GenericFile
Body [Body is file based: GenericFile[test.csv]]]
堆栈跟踪
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
默认情况下,direct
组件期望每个生产者都有一个匹配的消费者。请注意 Camel Documentation 中显示的新配置选项 failIfNoConsumers
。没有消费者,交换就无处可去。您可以考虑像这样添加另一条路线:
public class SampleTwo {
public static void main(String[] args) throws Exception {
final CamelContext camelContext = new DefaultCamelContext();
camelContext.start();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file://target/inbox?noop=true&fileName=test.csv").to("direct://start");
from("direct://start").to("file://target/outbox"); //ADDED
}
});
Thread.sleep(1000*6000);
}}
这个例外
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://XXXXX
当您忘记启动 Camel 上下文并创建 Producer/Consumer 模板时也会抛出,就像我一样....
我花了半天时间才弄明白:-(,所以别忘了
context.start()
为什么要直接传递给它?如果您没有直接的消费者?我可以知道用例吗?
您甚至可以在 from endpoint 之后添加一个日志端点并终止路由。
如果你有多个 camelContext 并且你没有提到正确的 camelContext id 那么你也会得到这个异常。
我有一个简单的问题。我无法从文件端点读取到直接端点。下面是代码片段:
public class SampleTwo {
public static void main(String[] args) throws Exception {
final CamelContext camelContext = new DefaultCamelContext();
camelContext.start();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file://target/inbox?noop=true&fileName=test.csv").to("direct://start"); //Fails with "No consumers available on endpoint" exception
//from("file://target/inbox?noop=true&fileName=test.csv").to("file://target/outbox"); //Works
}
});
Thread.sleep(1000*6000);
// stop the CamelContext
// camelContext.stop();
}}
我遇到异常 "No consumers available on endpoint"。这是一个简单的路由 & 我已经做了我能做的一切 - 现在花了 10 多个小时:(
请帮助...跟踪堆栈跟踪(启用跟踪)
[hread #0 - file://target/inbox] EventHelper
TRACE Notifier: org.apache.camel.impl.DefaultRuntimeEndpointRegistry@99e74a is not enabled for the event: ID-01HW466539-57567-1431438054047-0-41 exchange failure: Exchange[test.csv]
cause
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
[hread #0 - file://target/inbox] FileConsumer
TRACE Done processing file: GenericFile[test.csv] synchronously
[hread #0 - file://target/inbox] DefaultErrorHandler
ERROR Failed delivery for (MessageId: ID-01HW466539-57567-1431438054047-0-42 on ExchangeId: ID-01HW466539-57567-1431438054047-0-41). Exhausted after delivery attempt:
1 caught:
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
消息历史记录
--------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [file://target/inbox?fileName=test.csv&noop=true ] [ 3]
[route1 ] [to1 ] [direct://start ] [ 0]
交换
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id ID-01HW466539-57567-1431438054047-0-41
ExchangePattern InOnly
Headers {breadcrumbId=ID-01HW466539-57567-1431438054047-0-42, CamelFileAbsolute=false, CamelFileAbsolutePath=C:\folder\eclipse-ws-march\camelsampletwo\target\inbox\test.csv, CamelFileContentType=null, CamelFileLastModified=1431426831841, CamelFileLength=45, CamelFileName=test.csv, CamelFileNameConsumed=test.csv, CamelFileNameOnly=test.csv, CamelFileParent=target\inbox, CamelFilePath=target\inbox\test.csv, CamelFileRelativePath=test.csv, CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType org.apache.camel.component.file.GenericFile
Body [Body is file based: GenericFile[test.csv]]]
堆栈跟踪
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://start]. Exchange[test.csv]
默认情况下,direct
组件期望每个生产者都有一个匹配的消费者。请注意 Camel Documentation 中显示的新配置选项 failIfNoConsumers
。没有消费者,交换就无处可去。您可以考虑像这样添加另一条路线:
public class SampleTwo {
public static void main(String[] args) throws Exception {
final CamelContext camelContext = new DefaultCamelContext();
camelContext.start();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file://target/inbox?noop=true&fileName=test.csv").to("direct://start");
from("direct://start").to("file://target/outbox"); //ADDED
}
});
Thread.sleep(1000*6000);
}}
这个例外
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://XXXXX
当您忘记启动 Camel 上下文并创建 Producer/Consumer 模板时也会抛出,就像我一样....
我花了半天时间才弄明白:-(,所以别忘了
context.start()
为什么要直接传递给它?如果您没有直接的消费者?我可以知道用例吗?
您甚至可以在 from endpoint 之后添加一个日志端点并终止路由。
如果你有多个 camelContext 并且你没有提到正确的 camelContext id 那么你也会得到这个异常。