Double-click the cFile component labeled
Sender to open its Basic settings view in the Component tab.
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.
Double-click the cMessageFilter component
to open its Basic settings view in the
Component tab.
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']".
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.
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.
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!