Skip to main content Skip to complementary content
Close announcements banner

Configuring the components

Procedure

  1. Double-click the cFile component labeled Source to display its Basic settings view in the Component tab.
  2. 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.
  3. Double-click the cWireTap component to display its Basic settings view in the Component tab.
  4. 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:
    System.out.println("\nMessage wiretapped: "+
    exchange.getIn().getHeader("CamelFileName"));
    System.out.println("Message content: "+
    exchange.getIn().getBody(String.class)+"\n");
  5. Double-click the cJavaDSLProcessor component to display its Basic settings view in the Component tab.
  6. In the Code field, enter the Java code .to("direct:b") to define the URI of the endpoint to route the original message to.
  7. 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.
  8. 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.
  9. 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 – let us know how we can improve!