Configuring the components and connections - 7.3

Filter (Mediation)

author
Talend Documentation Team
EnrichVersion
Cloud
7.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Routing components (Mediation) > Filter components (Mediation)
Data Quality and Preparation > Third-party systems > Routing components (Mediation) > Filter components (Mediation)
Design and Development > Third-party systems > Routing components (Mediation) > Filter components (Mediation)
EnrichPlatform
Talend Studio

Procedure

  1. Double-click the cFile component labeled Sender to open its Basic settings view in the Component tab.
  2. In the Path field, specify the file path to message source.
  3. From the Encoding list, select the encoding type of your message files. Leave the other parameters as they are.
  4. Double-click the cMessageFilter component to open its Basic settings view in the Component tab.
  5. Select the language of the expression you want to use to filter your messages, and enter an expression to define a criterion according to which you want to filter your messages.
    In this scenario, we want to sort out the XML files containing a city node with the value of Paris, so we select XPath from the Language list, and fill the in the Expression field with this expression: "/person[city='Paris']".
  6. Double-click the cFile component labeled Paris_only to open its Basic settings view in the Component view, and specify the path for the messages meeting the filter criterion in the Path field.
    Repeat this step to define the path for all the messages from the sender in the cFile component labeled Unfiltered.
  7. Double-click the cProcessor component labeled Monitor_Paris to open its Basic settings view in the Component view, and customize the code in the Code area to display the file names of the messages that meet the filter criterion on the console:
    System.out.println("Message sent to folder Paris_only: "+
    exchange.getIn().getHeader("CamelFileName"));
    Repeat this step to customize the code in the cProcessor component labeled Monitor_Unfiltered to display the file names of all the messages from the sender.
  8. Press Ctrl+S to save your Route.