Apache camel 骆驼+;豆角
如何在ApacheCamel中使用带Bean的pollRich 我尝试过使用它,但得到的结果是“您不能从bean端点消费”,在这种情况下,我调用RESTAPI,但客户端提供了jar文件,所以我需要调用bean并获取更多信息Apache camel 骆驼+;豆角,apache-camel,Apache Camel,如何在ApacheCamel中使用带Bean的pollRich 我尝试过使用它,但得到的结果是“您不能从bean端点消费”,在这种情况下,我调用RESTAPI,但客户端提供了jar文件,所以我需要调用bean并获取更多信息 from("quartz2://tsTimer?cron=" + cron + "&trigger.timeZone=" + timezone) .bean(tradingService) .process(new Processor(
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();
只需使用
increment
,这是用于使用生产者端的,例如increment(…)
。如果需要通过聚合策略将数据合并在一起,可以使用该方法。但是,如果您只想得到bean的结果/输出,那么使用普通的to
,而不是如果bean方法是void
方法