Apache camel Apache Camel EIP路由-如何停止拆分()
我对以下路线有一些问题:Apache camel Apache Camel EIP路由-如何停止拆分(),apache-camel,cxf,eip,Apache Camel,Cxf,Eip,我对以下路线有一些问题: // from("cxf:....")... from("direct:start").process(startRequestProcessor) // STEP 1 .choice() .when(body().isNull()) .to("direct:finish") .otherwise()
// from("cxf:....")...
from("direct:start").process(startRequestProcessor) // STEP 1
.choice()
.when(body().isNull())
.to("direct:finish")
.otherwise()
.split(body()) // STEP 2
.bean(TypeMapper.class) // STEP 3
.log("Goes to DynamicRouter:: routeByTypeHeader with header: ${headers.type}")
.recipientList().method(Endpoint1DynamicRouter.class, "routeByTypeHeader") // STEP 4
.ignoreInvalidEndpoints();
from("direct:endpoint2") // STEP 6
.log("Goes to DynamicRouter::routeByCollectionHeader with header: ${headers.collection}")
.recipientList().method(Endpoint2DynamicRouter.class, "routeByCollectionHeader")
.ignoreInvalidEndpoints();
from("direct:endpoint1.1") // STEP 5
.process(new DateRangeProcessor())
.to("direct:collections");
from("direct:endpoint1.2") // STEP 5
.process(new SingleProcessor())
.to("direct:collections");
from("direct:endpoint2.2") // STEP 7
.aggregate(header("collection" /** endpoint2.2 */), CollectionAggregationStrategy)
.completionSize(exchangeProperty("endpoint22"))
.process(new QueryBuilderProcessor())
.bean(MyService, "getDbCriteria")
.setHeader("collection", constant("endpoint2.1"))
.to("direct:endpoint2.1").end();
from("direct:endpoint2.1") // STEP 8
.aggregate(header("collection" /** endpoint2.1 */), CollectionAggregationStrategy)
.completionSize(exchangeProperty("CamelSplitSize"))
.to("direct:finish").end();
from("direct:finish")
.process(new QueryBuilderProcessor())
.bean(MyRepository, "findAll")
.log("ResponseData: ${body}").
marshal().json(JsonLibrary.Gson).end();
路线
- 路由输出中有什么错误
- 两个recipientList()都尝试转发 发送到无效端点的消息(我必须使用.ignoreInvalidEndpoints()以避免异常): org.apache.camel.NoSuchEndpointException:找不到以下对象的终结点: org.springframework.data.mongodb.core.query。Criteria@20f55e70请 检查类路径是否包含所需的Camel组件jar
谢谢。我觉得很奇怪,但是.aggregate()函数不回复exchange。它使用聚合策略,但始终回复传入的exchange。这在阅读文档时并不清楚,但您必须使用聚合策略和split()才能返回exchange