On Wed, Jul 6, 2011 at 1:04 AM, Brendan Long <[email protected]> wrote:
> I've been working on this for a couple days and can't seem to get it
> working. What I want is to send a message using a ProducerTemplate, have
> it go to JMS, then another Camel route, then return a response (through
> the ProducerTemplate).
>
> This page seems to indicate that the last message send in the route will
> be returned back to the caller:
> https://cwiki.apache.org/confluence/display/CAMEL/Using+getIn+or+getOut+methods+on+Exchange
>
> But the message that gets returned is the same one that I sent through
> the ProducerTemplate.
>
> My CamelContext looks like this:
>
>    <camel:camelContext xmlns="http://camel.apache.org/schema/spring";>
>        <endpoint id="source" uri="jms:${sourceQueue}"/>
>        <endpoint id="destination" uri="jms:${destinationQueue}"/>
>        <camel:route>
>            <from ref="source"/>
>            <transacted/>
>            <process ref="validator"/>
>            <camel:split stopOnException="true" strategyRef="aggregator">
>                <camel:method ref="splitter" method="split"/>
>                <camel:inOnly ref="destination"/>
>            </camel:split>
>            <process ref="printStuff"/>

Try adding
<setExchangePattern pattern="InOut"/>

as last step in the route to ensure the MEP is InOut so the
JmsConsumer can detect this and return the reply.
I think we recently fixed that using <inOnly> etc. not affecting the
MEP successively on trunk.

>        </camel:route>
>    </camel:camelContext>
>
> My printStuff processor just prints the message for debug purposes, and
> it shows the exact message I want returned (and doesn't change
> anything). So if all I needed to do is make the last message the one I
> want returned, I've already done that.
>
> The producer side is like this:
>
>    Exchange exchange = this.producerTemplate.send(this.endpoint,
>    ExchangePattern.InOut, new Processor() {
>        @Override
>        public void process(Exchange exchange) throws Exception {
>            exchange.setIn(message);
>        }
>    });
>
> Can anyone help me out with this? I can't figure out what I'm missing.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to