Scenario: Using cSplitter to split a message and aggregate replies from
sub-messages
This scenario applies only to a Talend solution with ESB.
In this scenario, we will use the cSplitter component
to split a message and aggregate the replies from sub-messages.
A predefined Java Bean, AppendAggregator will be called to as the
strategy to aggregate the replies from sub-messages. For more information about creating
and using Java beans, see
Talend Studio User Guide.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
package beans; import org.apache.camel.Exchange; import org.apache.camel.processor.aggregate.AggregationStrategy; public class AppendAggregator implements AggregationStrategy { public Exchange aggregate(Exchange oldEx, Exchange newEx) { if(oldEx==null){ return newEx; } String oldBody = oldEx.getIn().getBody(String.class); String newBody = newEx.getIn().getBody(String.class); newEx.getIn().setBody(oldBody + " " + newBody); return newEx; } } |
Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Login
0 Comments