Creating a Java bean as the aggregation strategy - Cloud - 8.0

Aggregate (Mediation)

English (United States)
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Talend Studio
Data Governance > Third-party systems > Routing components (Mediation) > Aggregate components (Mediation)
Data Quality and Preparation > Third-party systems > Routing components (Mediation) > Aggregate components (Mediation)
Design and Development > Third-party systems > Routing components (Mediation) > Aggregate components (Mediation)

About this task

To aggregate the messages, we will use a Java bean that will help us build an aggregation strategy.


  1. From the repository tree view, expand the Code node and right click the Beans node. In the contextual menu, select Create Bean.
  2. The New Bean wizard opens. In the Name field, type in a name for the bean, for example, AggregateBody. Click Finish to close the wizard.
  3. Type in the codes as shown in the figure below. In this use case, we just want to aggregate all messages into a single message.
    package beans;
    import org.apache.camel.Exchange;
    import org.apache.camel.AggregationStrategy;
    public class AggregateBody implements AggregationStrategy{
    	public Exchange aggregate(Exchange oldEx, Exchange newEx) {
    			return newEx;
    		String oldBody = oldEx.getIn().getBody(String.class);
    		String newBody = newEx.getIn().getBody(String.class);
    		return newEx;
  4. Press Ctrl+S to save your bean.