camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankie_hr <franjo.zemu...@2e-systems.com>
Subject ExchangePattern.InOut ActiveMQ problem
Date Wed, 02 May 2012 12:22:20 GMT
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.

Mime
View raw message