Hi!
I need to do a synchronous request over JMS, and I was told this can be done
by using an InOut exchange. So I am doing something like this:
public Object sendSync(Object message, Address recipient, Map<String, Object>
hdrs) {
CamelTemplate<Exchange> template = new CamelTemplate<Exchange>(
routeContext );
Map<String, Object> headers = new HashMap<String, Object>();
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);
}
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=<null>]]
org.apache.camel.ExchangeTimedOutException: The OUT message was not received
within: 20000 millis on the exchange: Exchange[JmsMessage:
PersonMessage[action=AUTHENTICATE,person=<null>]]
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
Best regards,
Lars Ivar Igesund