Apache camel 组合消息处理器
Apache camel Composed Message Processor
我在我的应用程序中使用 Apache Camel。我正在尝试使用组合消息处理器。我有交换,其正文包含一些要命中的 URL,并且通过使用 split(body(), MyAggregationStrategy()),我试图从 urls 获取数据并使用聚合策略想要组合每个数据。但是有一个问题让我卡住了。如果正文的第一行有一些无效 url 那么聚合工作正常但它不会移动到下一个处理器,如果无效 url 在除第一行以外的任何其他地方工作正常..
请帮忙,
下面是参考代码
onException(HttpOperationFailedException.class).handled(true)
.retryAttemptedLogLevel(LoggingLevel.DEBUG)
.maximumRedeliveries(5).redeliveryDelay(3000)
.process(new HttpExceptionProcessor(exceptions));
from("jms:queue:supplier")
.process(
new RequestParserProcessor(payloadDetailsMap,
metaDataDetailsPOJO, routesEndpointNamePOJO))
.choice().when(new AggregateStrategy(metaDataDetailsPOJO))
.to("direct:aggregate").otherwise().to("direct:single");
from("direct:aggregate").process(new SplitBodyProcessor())
.split(body(), new AggregatePayload(aggregatePayload))
.to("direct:aggregatepayloadData").end()
.to("direct:payloadDataAggregated").end();
from("direct:aggregatepayloadData").process(basicProcessor)
.recipientList(header(ApplicationConstants.URL));
from("direct:payloadDataAggregated")
.process(
new AggregateJsonGenerator(aggregatePayload,
payloadDetailsMap, metaDataDetailsPOJO)).
在这段代码中,如果第一次点击时出现一些无效 url,则永远不会调用 AggregateJsonProcessor..
您可能需要在 OnException 代码中设置 continue(true)。看这里:
http://camel.apache.org/exception-clause.html
我在我的应用程序中使用 Apache Camel。我正在尝试使用组合消息处理器。我有交换,其正文包含一些要命中的 URL,并且通过使用 split(body(), MyAggregationStrategy()),我试图从 urls 获取数据并使用聚合策略想要组合每个数据。但是有一个问题让我卡住了。如果正文的第一行有一些无效 url 那么聚合工作正常但它不会移动到下一个处理器,如果无效 url 在除第一行以外的任何其他地方工作正常.. 请帮忙, 下面是参考代码
onException(HttpOperationFailedException.class).handled(true)
.retryAttemptedLogLevel(LoggingLevel.DEBUG)
.maximumRedeliveries(5).redeliveryDelay(3000)
.process(new HttpExceptionProcessor(exceptions));
from("jms:queue:supplier")
.process(
new RequestParserProcessor(payloadDetailsMap,
metaDataDetailsPOJO, routesEndpointNamePOJO))
.choice().when(new AggregateStrategy(metaDataDetailsPOJO))
.to("direct:aggregate").otherwise().to("direct:single");
from("direct:aggregate").process(new SplitBodyProcessor())
.split(body(), new AggregatePayload(aggregatePayload))
.to("direct:aggregatepayloadData").end()
.to("direct:payloadDataAggregated").end();
from("direct:aggregatepayloadData").process(basicProcessor)
.recipientList(header(ApplicationConstants.URL));
from("direct:payloadDataAggregated")
.process(
new AggregateJsonGenerator(aggregatePayload,
payloadDetailsMap, metaDataDetailsPOJO)).
在这段代码中,如果第一次点击时出现一些无效 url,则永远不会调用 AggregateJsonProcessor..
您可能需要在 OnException 代码中设置 continue(true)。看这里: http://camel.apache.org/exception-clause.html