Procedure
-
Double-click the cFile
component, which is labelled Source, to display its Basic settings view in the Component tab.
-
In the Path field, specify the file path to the message source.
From the Encoding list, select the encoding type of your source files, and leave all the other parameters as they are.
-
Double-click the cIdempotentComsumer component, which is labelled
Deduplicator, to display its Basic
settings view in the Component
tab.
-
From the Repository Type list, select between Memory and File to specify where the message identifiers will be stored before the deduplication process. For this scenario, select File.
In the File store field, specify the location of the file storing message identifiers.In the Expression field, enter an expression to filter the messages. In this scenario, enter the following expression to filter the messages according to the person node of the XML files: xpath("/people/person"), and leave all the other parameters as they are. Alternatively, you can select the Use language check box, select XPath from the Language list, and enter "/people/person" in the Predicate field.
-
Double-click the cProcessor
component labelled Unique to display its Basic settings view in the Component tab.
-
In the Code area, customize the code to
display the file name of the message that passes the deduplication:
System.out.println("Message consumed on Unique: "+ exchange.getIn().getHeader("CamelFileName"));
-
Repeat these steps to configure the other cProcessor component, which is labelled All, to display the file names of all the
messages coming from the source:
System.out.println("Message consumed on All: "+ exchange.getIn().getHeader("CamelFileName"));
- Press Ctrl+S to save your Route.