Double-click the cFile component
labeled Source_file to open its Basic
settings view in the Component
tab.
In the Path field, fill in or
browse to the path where the source file Hello.txt is located.
Keep the default settings for other fields.
Double-click the cMulticast
component labeled Multicast to open its Basic settings view in the Component tab.
In the URIS table, click the
plus button to add two lines and specify the URIs of the endpoints where the message
will be sent, "direct:a" and "direct:b"
in this use case.
Double-click the cMessagingEndpoint component labeled direct_a
to open its Basic settings view in
the Component tab.
In the URI field, enter the
endpoint URI, "direct:a" in this use case.
Repeat this step to set the endpoint URI for
direct_b as "direct:b".
Double-click the cProcessor
component labeled Monitor_source to open its Basic settings view in the Component tab.
In the Code box, enter the code below to
print the source message in the console.
System.out.println("The source message is: " + exchange.getIn().getBody(String.class));
Repeat this step to customize the code of Monitor_endblock, Monitor_direct_a, and Monitor_direct_b as shown below to print the message of each
endpoint.
Monitor_endblock:
System.out.println("The endblock message is: " + exchange.getIn().getBody(String.class));
Monitor_direct_a:
System.out.println("direct a just downloaded: "+exchange.getIn().getBody(String.class));
Monitor_direct_b:
System.out.println("direct b just downloaded: "+exchange.getIn().getBody(String.class));
Double-click the cSetBody
component labeled Set_new_body to open its Basic settings view in the Component tab.
Select SIMPLE in the Language list.
In the Expression field, enter
"New message" as the new message body.
Repeat this step to set the message body for
direct:a and direct:b as
"message A" and "message B"
respectively.
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!