【发布时间】:2019-02-11 10:41:33
【问题描述】:
如何在 Apache Camel 中将 pollEnrich 与 Bean 一起使用?
我尝试使用它,但在这种情况下得到“你不能从 bean 端点消费”的异常,我正在调用 rest api 但客户端提供了 jar 文件,所以我需要调用 bean 并获取更多信息。
from("quartz2://tsTimer?cron=" + cron + "&trigger.timeZone=" + timezone)
.bean(tradingService)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.setProperty("fileName","input-" + dateFormat.format(new Date()) + ".xml");
}
})
.pollEnrich("bean:tradingService", new AggregationStrategy() {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
System.out.println("oldExchange : " + oldExchange +" newExchange : " + newExchange);
return null;
}
})
.marshal().jacksonxml(true)
.wireTap("file:" + auditDir + "/?fileName=${header.fileName}")
//split or merge
.to("xslt:trans.xslt")
.to(outQueue)
.to("log:org.ts.tradingservice.camel?level=INFO&showBody=true")
.end();
【问题讨论】:
标签: apache-camel