Sending messages directly to a Camel endpoint
You can utilize Camel's endpoints directly from your Java code, making it easy to, for example, send a JMS message without any of the boilerplate code that is normally required. Camel makes it easy to send (one-way) or request (request-response) data from any Camel component or route. Camel calls this POJO Producing.
This recipe will show you how you can send data to a Camel endpoint, including a Camel route, from within your Java code.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.extend.produce
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with produce
.
The included example uses an embedded (in-process) ActiveMQ instance to act as a JMS provider for its simple JMS message consuming method. In practice, you would normally connect Camel to an external messaging infrastructure.
How to do it...
Camel's POJO Producing makes use of the Camel's ProducerTemplate...