Double-click the cFile
component labeled Source to display its Basic settings view in the Component tab.
In the Path field, browse to
or enter the input file path. In this use case, there is a
Hello.txt file in the specified file path, which contains the
content Hello World!. Leave the other parameters as they are.
Double-click the cWireTap
component to display its Basic settings
view in the Component tab.
Enter "direct:a" in the URI field to route the wiretapped message to this
endpoint.
Select the Populate new
exchange check box, select Processor as the populate type, and then enter the following code in
the Code box to display the file name of the
wiretapped message and its content on the console:
Double-click the cJavaDSLProcessor component to display its Basic settings view in the Component tab.
In the Code field, enter the
Java code .to("direct:b") to define the URI of the endpoint to
route the original message to.
Double-click the cMessagingEndpoint component labeled
Endpoint_a to display its Basic
settings view in the Component
tab. Enter "direct:a" in the URI field to retrieve the message routed to this endpoint.
Repeat this operation to set the endpoint URI for Endpoint_b.
Double-click the cProcessor
component labeled Monitor_a to display its Basic settings view in the Component tab. Enter the following code in the Code box to display the file name of the message routed
to Endpoint_a.
System.out.println("Message on endpoint a: "+
exchange.getIn().getHeader("CamelFileName"));
Then, configure the other cProcessor
component in the same way to display the file name of the message routed to Endpoint_b.
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!