我遇到了一个简单的问题。我无法从文件端点读取到直接端点。以下是代码段:
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();
}}
我得到一个例外"端点上没有可用的消费者"。这是一个简单的路由&我现在所做的一切都超过了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]
答案 0 :(得分:10)
默认情况下,.parentclass ul li a{
color:red;
background:black;
}
组件期望每个生产者都有匹配的使用者。请注意Camel Documentation中显示的新配置选项direct
。没有消费者,交易所无处可去。您可以考虑添加另一条路径:
failIfNoConsumers
答案 1 :(得分:4)
此例外
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://XXXXX
当你忘记启动Camel上下文并创建像我这样的生产者/消费者模板时,也会抛出....
我花了半天才发现:-(所以不要忘记
context.start()
答案 2 :(得分:0)
如果你有多个camelContext并且你没有提到正确的camelContext id,那么你也会得到这个例外。
答案 3 :(得分:-1)
为什么要直接传递给它?如果你不直接有任何消费者?我可以知道用例吗?
您甚至可以在端点之后添加日志端点并终止路由。