camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Having trouble with an InOut route
Date Wed, 06 Jul 2011 17:51:45 GMT
On Wed, Jul 6, 2011 at 1:04 AM, Brendan Long <brendan@realgo.com> 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"/>
>        </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.
>

Try removing the    <process ref="printStuff"/> to see if it works then.

And post the implementation of the code for your printStufff

> 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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message