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.

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.

Reply via email to