1
votes

I have an Apache Camel route configured in Spring which takes a message from a JMS (ActiveMQ) queue, transforms the message and uses the CXF component to send the results to a web service. This all works fine but I always get an exception thrown at the end of the route that the CXF response object isn't synchronizable, referring to the fact that it's trying to convert the exchange/message body back into a JMS message. But why?

Here's my camel context extract:-

<route>
  <from uri="jms:queue:transactions" />
  <process ref="convertToFormatForCXF" />
  <to uri="cxf:bean:myService?defaultOperationName=process" />
  <stop />
</route>

and here's a snippet from the logs:-

EndpointMessageListener        WARN  Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.lang.RuntimeException: net.sophis.soa.dataexchange.LogoutResponse]
org.apache.camel.RuntimeCamelException: java.lang.RuntimeException: net.sophis.soa.dataexchange.LogoutResponse
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1363)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:124)

Even the doesn't prevent the stack trace. Now I've found out that if I add the disableReplyTo=true to the JMS consumer then the stacktrace doesn't show which is excellent.

I suppose I'm just trying to work out what was happening? Was the CXF response object going to be added to the 'transactions' JMS queue? My intention was for the flow to stop once the CXF producer had completed.

Can anyone help my understanding please? The Camel documentation wasn't much help on this.

1

1 Answers

2
votes

Was the CXF response object going to be added to the 'transactions' JMS queue?

No. It would have been added to a temporary queue.

From http://camel.apache.org/jms.html#JMS-Request-replyoverJMS

The JmsProducer detects the InOut and provides a JMSReplyTo header with the reply destination to be used. By default Camel uses a temporary queue, but you can use the replyTo option on the endpoint to specify a fixed reply queue (see more below about fixed reply queue). Camel will automatic setup a consumer which listen on the reply queue, so you should not do anything.