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 ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.