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: ExchangePattern.InOut : I Can't get any response
Date Thu, 08 Dec 2011 12:27:00 GMT
Hi

You need the consumer on the other side, to send back the reply on the
given JMSReplyTo queue that has been enlisted in the JMS message.
And if the consumer does not do that without 20 sec, the producer will time out.

See for example this unit test
https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java

On Wed, Dec 7, 2011 at 5:55 PM, Gnarf <brichard@ecocea.com> wrote:
> Hi,
> I'm new to camel and i've tried to follow this example of implementation of
> the EndPoint Pattern : http://camel.apache.org/tutorial-jmsremoting.html
>
> I'm running an activeMQ on a VM. the producer & the consumer code are on
> different pc.
> My goal is to send an xml File from the producer to the broker, do some
> operation on it and send an acknowledgment to the producer.
>
> here is how i did it :
>        context = new ClassPathXmlApplicationContext("camel-client.xml");
>        CamelContext camel = (CamelContext) context.getBean("camel-client");
>       // get the endpoint from the camel context
>       endpoint = camel.getEndpoint("jms:topic:"+topicName);//topicName is
> an argument of the java Program.
>      Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
>      // set the input on the in body
>     exchange.getIn().setBody( msg ); //"msg" is the content of my xmlFile
> in a String object .
>    // to send the exchange we need an producer to do it for us
>     Producer producer = endpoint.createProducer();
>        // start the producer so it can operate
>         producer.start();
>         producer.process(exchange);
>
> And now i'm waiting for the answer before to stop the producer...
>  System.out.println("... the result is : " + exchange.getOut().getBody());
>  producer.stop()
> I always get the TimedOutException : The OUT message was not received
> within: 20000 millis. Exchange[Message: test]
> and i don't understand why. The consumer code works fine, the route i
> specified is working well (i.e. the message coming from the topic is
> consumed in the bean of my choice).
> The method that I call in my consumer returns a String "OK" or "KO",
> depending on the validity of the XML file and a bunch of other stuff :)
>
> I just don't get it, the exchange.getOut() is always null; how am I supposed
> to set the response to the producer ? :/
> Any help will be appreciated :)
> Bertrand
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ExchangePattern-InOut-I-Can-t-get-any-response-tp5056301p5056301.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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