Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 10117 invoked from network); 30 Sep 2008 11:37:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2008 11:37:22 -0000 Received: (qmail 81803 invoked by uid 500); 30 Sep 2008 11:37:20 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 81677 invoked by uid 500); 30 Sep 2008 11:37:20 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 81666 invoked by uid 99); 30 Sep 2008 11:37:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 04:37:20 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of james.strachan@gmail.com designates 209.85.217.15 as permitted sender) Received: from [209.85.217.15] (HELO mail-gx0-f15.google.com) (209.85.217.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 11:36:17 +0000 Received: by gxk8 with SMTP id 8so11163469gxk.14 for ; Tue, 30 Sep 2008 04:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=8yQuyb2nhdrUXJx1BJwk7GXV+1XYuhqwQ4eYtoVtEPo=; b=G1Ka4lWpbSWKfeF+ZR0IBnZzMy1y7M7VQ9XeKQjzbXR7sBwRkYnwJ92wBuz5TLay9y lRf5LMeE3Xq8AmiML3I3ayzyDMYv0sEzWUyQkWM8Jo6Ifa849ViNApLJ0iTl23RhfkFv lu02FU9jQr6FP4k//9ufE5iSrYlF914wzNtf0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=GO9xXjKZYHm+ihMlYve4pAc6IDxfPGAcaGb9PFQDWZF2vv+AkGuxsAVhpNELeDrf47 VHyMvvqCjLCOIXWRiP2xB4KhJbuOO5SCHh9eYTocngDIIslGgcNafJ5mCRgJbVuaDGW0 LPOUyr07zkn+4wuxw2xQnJv2NiIkNkZDWZ4Cs= Received: by 10.90.26.9 with SMTP id 9mr7162431agz.53.1222774606784; Tue, 30 Sep 2008 04:36:46 -0700 (PDT) Received: by 10.90.117.12 with HTTP; Tue, 30 Sep 2008 04:36:46 -0700 (PDT) Message-ID: Date: Tue, 30 Sep 2008 12:36:46 +0100 From: "James Strachan" To: camel-user@activemq.apache.org Subject: Re: Getting a reply to an exchange over JMS In-Reply-To: <200809301326.58073.larsivar@igesund.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200809301326.58073.larsivar@igesund.net> X-Virus-Checked: Checked by ClamAV on apache.org 2008/9/30 Lars Ivar Igesund : > Hi! > > I need to do a synchronous request over JMS, and I was told this can be done > by using an InOut exchange. It sure can - e.g. try doing some remoting over JMS... http://activemq.apache.org/camel/spring-remoting.html > So I am doing something like this: > > public Object sendSync(Object message, Address recipient, Map > hdrs) { > > CamelTemplate template = new CamelTemplate( > routeContext ); > Map headers = new HashMap(); > if (hdrs != null) > headers.putAll(hdrs); > headers.put( "to", recipient.getAsString() ); > headers.put( "from", address.getAsString() ); > > DefaultExchange exchange = new DefaultExchange(routeContext); > exchange.setPattern(ExchangePattern.InOut); > exchange.getIn().setBody(message); > exchange.getIn().setHeaders(headers); > > return template.send("seda:outbox", exchange); > } BTW you can use the template.request*() methods instead of sending with a custom pattern. > and in the other end: > > from("myqueu").process(new MyProcessor()); > > and MyProcessor does > > Message m = exchange.getOut(true); > m.setBody(retpm); > exchange.setOut(m); > > The exhange is processed, but the sendSync does not seem to return, and after > a short while I start getting > > org.apache.camel.ExchangeTimedOutException: The OUT message was not received > within: 20000 millis on the exchange: Exchange[JmsMessage: > PersonMessage[action=AUTHENTICATE,person=]] > org.apache.camel.ExchangeTimedOutException: The OUT message was not received > within: 20000 millis on the exchange: Exchange[JmsMessage: > PersonMessage[action=AUTHENTICATE,person=]] > at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:114) > at > org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44) > at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73) > at > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143) > at > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:85) > at > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40) > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44) > at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68) > at > org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:66) > at > org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531) > at > org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466) > at > org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435) > at > org.springframework.jms.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:407) > at > org.springframework.jms.listener.SimpleMessageListenerContainer$2.onMessage(SimpleMessageListenerContainer.java:204) > at > org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:967) > at > org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122) > at > org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192) > at > org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) > at > org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > > > I suppose I am missing something to finish off the exchange, but I can't seem > to find any references to what this is. To me it seems I'm doing what is > hinted to in some earlier mailing list discussions. > > We are currently using Camel 1.3.0 Could you try 1.4.0 - I can't remember when JMS InOut support was added? -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com