Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Message

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

To support various message exchange patterns like one way event messages and request-response Event Message and Request Reply messages Camel uses an Exchange interface which is used to handle either oneway messages with has a pattern property which can be set to InOnly for an Event Message which has a single inbound Message, or request-reply 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

Requestor Code

Code Block

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

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

Route Using the Fluent Builders

Code Block

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

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

Route Using the Spring XML Extensions

Code Block

<route>
  <from uri="direct:startInOnly"/>
  <inOnly uri="bean:process"/>
</route>

<route>
  <from uri="direct:startInOut"/>
  <inOut uri="bean:process"/>
</route>
Include Page
Include Page
CAMEL:Using This PatternCAMEL:
Using This Pattern