Skip to main content Skip to complementary content

Configuring the components and connections

About this task

The cMessageRouter component does not have any property as it filters and routes the messages from one endpoint to others based on the conditions set in its When connection(s).

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.
    From the Encoding list, select the encoding type of your message files. Leave the other parameters as they are.
  3. In the design workspace, click the When connection you created and click the Component view to define a filter against which messages will be routed.
  4. In the Type list, select xpath because the format of the messages used is XML.
    In the Condition field, type in "/person[city='Paris']" to retrieve only those messages in which the value of the city node is Paris.
  5. Double-click the cMessagingEndpoint component labeled directParis to open its Basic settings view in the Component tab.
  6. In the URI field, enter the endpoint URI, for example, "direct:Paris" to receive the filtered message.
  7. Repeat these steps to set the endpoint URI of the cMessagingEndpoint components labeled directOthers as "direct:Others". Set the endpoint URIs of the cMessagingEndpoint components labeled directParisRoute and directOthersRoute as "direct:Paris" and "direct:Others" respectively.
  8. Double-click the cFile component labeled Receiver_Paris to open its Basic settings view in the Component tab, 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 other messages from the sender in the cFile component labeled Receiver_Others.
  9. Double-click the cLog component labeled Monitor_Paris to open its Basic settings view in the Component tab.
  10. Select INFO in the Level list. Select the Specify output log message option and enter the following code in the Message field to display the filename of the message sent to the specified directory.
    Message sent to folder Paris_only: ${header.CamelFileNameOnly}
    Repeat this step to customize the message in the cLog component labeled Monitor_Others to display the filename of the message sent to the specified directory.
  11. Press Ctrl+S to save your Route.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!