Message

Camel supports the Message from the EIP patterns using the Message interface.

image

To support various message exchange patterns like one way Event Message and Request Reply messages Camel uses an Exchange interface which has a pattern property which can be set to InOnly for an Event Message which has a single inbound Message, or InOut for a Request Reply where there is an inbound and outbound message.

Here is a basic example of sending a Message to a route in InOnly and InOut modes using a ProducerTemplate

//InOnly
getContext().createProducerTemplate().sendBody("direct:startInOnly", "Hello World");

//InOut
Object result = getContext().createProducerTemplate().requestBody("direct:startInOut", "Hello World");

And an example with routes:

from("direct:startInOnly")
  .inOnly("bean:process");

from("direct:startInOut")
  .inOut("bean:process");