camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paquettd <>
Subject @RecipientList and ProducerTemplate (Camel 1.6 and 1.5)
Date Thu, 26 Feb 2009 15:52:00 GMT

I'm seeing a behavior in camel 1.6 I don't understand. when I used the
producerTemplate to kickoff a workflow that
includes a @RecipientList component I seem to get back the result of the
recipient list... but my other services
end up being called (and their results simply lost to the ether).

Here are some details (scrubbed of the real names; but the same idea)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <bean id="serviceA" class="example.ServiceAImpl"/>
    <bean id="serviceB" class="example.ServiceAImpl"/>
    <bean id="serviceC" class="example.ServiceAImpl"/>

    <bean id="myRouter" class="example.MyRouter">
        <property name="passUrl" value="direct:needABC"/>
        <property name="failUrl" value="direct:needBC"/>

    <camelContext xmlns="">
        <template id="myCamelTemplate" defaultEndpoint="direct:test"/>

            <from uri="direct:test"/>
            <bean ref="myRouter"/>

            <from uri="direct:needABC"/>
            <bean ref="serviceA"/>
            <to uri="direct:needBC"/>
            <from uri="direct:needBC"/>
            <bean ref="serviceB"/>
            <bean ref="serviceC"/>

    <bean id="myTester" class="example.MyTester">
        <property name="producerTemplate" ref="myCamelTemplate"/>

My router class looks like:

public class MyRouter{

	public String passUrl = null;
	public String failUrl = null;
	public String route(String body) {
		// for testing always return passUrl
		return passUrl;
	public void setPassUrl(String url) {
		passUrl = url;
	public void setFailUrl(String url) {
		failUrl = url;

And finally my "tester" does this:

template.requestBody(template.getDefaultEndpoint(), "Hello World")

All my services expect a String in this test; they just mutate it
(capitalize, reverse, other trival ops)
for the purpose of testing. I get to all those breakpoints.

Anyway.. requestBody returns "direct:needABC" to me... but then I see
services A,B and C getting called.
If I changed direct:test to seda:test I get back my original input... and
services A,B and C still get called.
Both ways the result are lost.

Am I missing something very obvious?

FYI I was trying to avoid using @RecipientList and using <choose><when> etc
with groovy or javascript to do my
content based routing. Unfortunatly I'm using Java 5 without
javax.scripting. I tried installing
the javax.scripting implementation from but couldn't quite get it
going in my OSGi container.
I guess that's a different question; but that would be my preferred
View this message in context:
Sent from the Camel - Users (activemq) mailing list archive at

View raw message