【发布时间】:2011-12-11 02:07:21
【问题描述】:
我有一个从队列中读取的大型 XML 消息,我需要将其拆分成块并将其转换为对象,然后根据对象将它们路由到各个目的地。
所以我已经将 routeBuilder 配置为
ChoiceDefinition choice = from(routeConfig.getFromEndpoint())
.split().method(xmlSplitter, "splitMessage").streaming().process(xmlProcessor).choice();
for (RouteConfig filter : filters) {
choice = choice.when(header(REPORT_TYPE_HEADER_NAME).contains(filter.getReportTypeHeaderFilter()))
.to(filter.getToEndpoint());
}
choice.otherwise().to(routeConfig.getErrorEndpoint());
但是路由根本没有发生,所有消息都发送到errorEndpoint。 我发现原因是拆分器删除了标头,因为它在路由之前。
路由后好像不能使用拆分。
解决这个问题的方法是什么?
【问题讨论】:
标签: java integration apache-camel