Creating a Bean - Cloud - 8.0

Flatpack (Mediation)

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 > Processing components (Mediation) > Flatpack components (Mediation)
Data Quality and Preparation > Third-party systems > Processing components (Mediation) > Flatpack components (Mediation)
Design and Development > Third-party systems > Processing components (Mediation) > Flatpack components (Mediation)

About this task

In this section, a JavaBean is created to print the id, first name, and surname from the customer information with the corresponding column names into the execution console.


  1. From the repository tree view, expand the Code node and right click the Beans node. In the contextual menu, select Create Bean.
    The New Bean wizard opens. In the Name field, type in a name for the bean, for example, ReadOrder. Click Finish to close the wizard. The bean is opened automatically in the design workspace.
  2. Enter the following code in the design workspace.
    package beans;
    import org.apache.camel.Exchange;
    public class ReadOrder {
    	public static void getCustomer(Exchange exch) { 
    		if(exch.getIn().getBody() !=null)
    			java.util.Map data = exch.getIn().getBody(java.util.Map.class); 
    			if(data != null){ 
    				String id= (String)(data.get("id")); 
    				System.out.println("id :"+id);
    				String name= (String)(data.get("name")); 
    				System.out.println("name :"+name);
    				String surname= (String)(data.get("surname")); 
    				System.out.println("surname :"+surname);
    				exch.getIn().setBody("<customer><id>" + id + "</id><name>" + name + "</name><surname>" + surname + "</surname></customer>", String.class);
  3. Press Ctrl+S to save your bean.


For more information about creating and using JavaBeans, see Talend Studio User Guide.