On Wed, May 2, 2012 at 4:42 PM, Stefan Burkard <sburk...@gmail.com> wrote:
> I think you can use ".setExchangePattern(ExchangePattern.InOut)"
> instead of the deprecated ".inOut()"
>

Yes thats what we favor

setExchangePattern to change the pattern from this point forward
to(pattern, uri) to use a specific pattern for sending to this endpoint only.

eg we deprecated the others to trim down the DSL, as we got a lot in
there already.


> Cheers
> Stefan
>
>
> On Wed, May 2, 2012 at 2:22 PM, frankie_hr
> <franjo.zemu...@2e-systems.com> wrote:
>> Hi All,
>>
>> I have an issue with returning an object back to the caller while using the
>> ProducerTemplate.requestBody() method and ActiveMQ since I upgraded to more
>> recent versions of Camel (2.9.2) and ActiveMQ (5.5.1). I didn't have such
>> problems earlier when using Camel 2.5.0 and ActiveMQ 5.4.2, but since I
>> upgraded, the from("endpoint").inOut() method showed as Deprecated and I
>> couldn't get this test running ever since I removed the inOut(). Please
>> advise!
>>
>> My route is defined as follows:
>>
>> from("activemq:queue:start")
>>    // used to be .inOut() here
>>    .to(BEAN + "handler" + METHOD + "printType")
>>    .to(BEAN + "handler" + METHOD + "doesNothing")
>>    .to(BEAN + "handler" + METHOD + "printType")
>>    .to(ExchangePattern.InOut, "activemq:queue:continue");
>>
>> from("activemq:queue:continue")
>>    // used to be .inOut() here
>>    .to(BEAN + "handler" + METHOD + "printType")
>>    .to(BEAN + "handler" + METHOD + "doesNothing")
>>    .to(BEAN + "handler" + METHOD + "printType");
>>
>>
>> The definitions of "printType" and "doesNothing" methods are:
>>
>>    @InOut
>>    public void doesNothing(Object o, Exchange exchange) {
>>
>>        logger.info("-----> doesNothing");
>>    }
>>
>>    @InOut
>>    public void printType(Object o) {
>>
>>        logger.info("-----> printType");
>>
>>        logger.info("Checkpoint: " + o.getClass().getName());
>>    }
>>
>>
>> The Junit is set up as follows:
>>
>>    @Test
>>    public void testCamel() {
>>
>>        // class A is just an empty class, no fields or methods
>>        A a = new A();
>>
>>        // defined as a bean via Spring
>>        ProducerTemplate camelTemplate = (ProducerTemplate)
>>
>> ApplicationContextProvider.getApplicationContext().getBean("camelTemplate");
>>
>>        try {
>>
>>            Object o = camelTemplate.requestBody("activemq:queue:start", a);
>>
>>            if (o != null) {
>>
>>                System.out.println("RETURNED: " + o.getClass().getName());
>>            }
>>
>>        } catch (Exception e) {
>>
>>            System.out.println("CAUGHT EXCEPTION:");
>>            e.printStackTrace();
>>        }
>>    }
>>
>> Whenever I execute this Junit, I get an exception:
>>
>> org.apache.camel.ExchangeTimedOutException: The OUT message was not received
>> within: 20000 millis due reply message with correlationID:
>> ID-franjo-laptop-33615-1335960044731-0-2 not received. Exchange[Message:
>> com.ee.jbube.temporary.A@6366ce5f]
>>        at
>> org.apache.camel.component.jms.reply.ReplyManagerSupport.processReply(ReplyManagerSupport.java:126)
>>        ...
>>
>>
>> If, for instance, I wasn't using "activemq:queue", but replaced it with
>> "seda", everything executes correctly and I get the following output:
>>
>> Camel thread #1 - seda://start - -----> printType
>> Camel thread #1 - seda://start - Checkpoint: com.ee.jbube.temporary.A
>> Camel thread #1 - seda://start - -----> doesNothing
>> Camel thread #1 - seda://start - -----> printType
>> Camel thread #1 - seda://start - Checkpoint: com.ee.jbube.temporary.A
>> Camel thread #2 - seda://continue - -----> printType
>> Camel thread #2 - seda://continue - Checkpoint: com.ee.jbube.temporary.A
>> Camel thread #2 - seda://continue - -----> doesNothing
>> Camel thread #2 - seda://continue - -----> printType
>> Camel thread #2 - seda://continue - Checkpoint: com.ee.jbube.temporary.A
>>
>> RETURNED: com.ee.jbube.temporary.A
>>
>>
>>
>> Kindest regards,
>> Franjo
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/ExchangePattern-InOut-ActiveMQ-problem-tp5680362.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
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