Multicast – routing the same message to many endpoints

When you want to route the same message to a number of endpoints and have them process the message in different ways, the Multicast EIP is a good choice.

This recipe will show you the default, sequential way to use Camel's Multicast EIP. Chapter 6, Parallel Processing, contains a recipe for using Multicast with concurrency (threads).

Getting ready

The Java code for this recipe is located in the org.camelcookbook.routing.multicast package. The Spring XML files are located under src/main/resources/META-INF/spring and prefixed with multicast.

How to do it...

Use the multicast DSL statement, and list the endpoints and processing steps within it.

In the XML DSL, this routing logic is written as:

<route> ...

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.