Java 8 and Apache Camel 2.19.5 here. I want to define a route (using Spring XML DSL) that accomplishes the following:
- Consumes a message from an ActiveMQ queue
- Deserializes the XML message from a String into a
Fizzbuzzinstance - Sends the
Fizzbuzzto aFoobarGeneratorprocessor - The
FoobarGeneratorprocessor generates aFoobaron the exchange - Copies of the
Foobarmessage then pass to two downstream processors at the same time: (a) TheConfiguratorprocessor and (b) theAnalyzerprocessor 6a. TheConfiguratorprocesses theFoobarand stores some results in a DB 6b. TheAnalyzerprocesses theFoobarand then the route sends that instance to a deserializer (back into a String) and then sends that String to another AMQ queue
Here's what I have so far:
<route id="fizzbuzz_processor">
<!-- Step 1: Consume Fizzbuzz XML from AMQ -->
<from uri="activemq:fizzbuzzes"/>
<!-- Step 2: Deserialize into Fizzbuzz POJO instance, using XStream -->
<unmarshall ref="xs"/>
<!--
Step 3 + 4: Send to FoobarGenerator processor;
output is a 'Foobar' POJO instance
-->
<to uri="bean:foobarGenerator"/>
<!-- Step 5: Send Foobar to two places at the same time -->
<multicast>
<!-- Step 6a: Foobar goes to Configurator processor -->
<to uri="bean:configurator"/>
<!-- Step 6b: Foobar also goes to Analyzer processor -->
<to uri="bean:analyzer"/>
<!--
AFTER Analyzer, Foobar gets serialized into XML and sent
to another queue
-->
<marshall ref="xs"/>
<to uri="activemq:foobars"/>
</multicast>
</route>
The problem with this setup is that, from what I can tell, multicasters can only be defined with the top-level endpoints that they will be sending the messages to. So the way I have it configured above, the multicaster will send the message to: (a) bean:configurator, (b) bean:analyzer, (c) XStream/marshaller, and (d) activemq:fizzbuzzes at the same time, as opposed to sending to bean:configurator and bean:analyzer at the same time, and then after bean:analyzer, marshalling and sending to AMQ.
How can I reconfigure this route to do what I want?