"Dynamic Routing" with Switchyard

Latest response

Been struggling again... tried the usual resources and I think my basic issue is translating 'base' camel into Switchyard implementations. Any suggestions? For example, trying to set a header inside a DRL; with base camel it should be:
then
$message.setHeader("routingSlip", "mock:queue:user_read");
end

But in Switchyard, the switchyard Header does not have that method signature... So, then I struggle with trying to implement that particular example into Switchyard.

All this to say this:
Trying to modify switchyard quickstart rules camel cbr to route 1 message to 1-n bean endpoints. Message with ID FF0000 to Red, etc, but then I need the case where, ID 010000 needs to go to Red and Green, then 02000 Green and Blue, etc....

Tried doing this with having a recipientList after Destination Bean DRL:
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="switchyard://RoutingService"/>
<to uri="switchyard://DestinationService"/>
<recipientList parallelProcessing="true" shareUnitOfWork="true">
<simple>${body.destination}</simple>
</recipientList>
</route>
</routes>

This does seem to work:
16:38:44,505 INFO [org.switchyard.quickstarts.rules.camel.cbr.BlueServiceBean] Blue service processing boxed widget with id: 0100FF-DEF-456
16:38:44,505 INFO [org.switchyard.quickstarts.rules.camel.cbr.GreenServiceBean] Green service processing boxed widget with id: 0100FF-DEF-456

Just curious if anyone has a better implementation 'best-practice' for me??

Attachments

Responses