5 Replies Latest reply on Apr 30, 2009 11:45 PM by njiang

    ClassCastException when using camel-cxf and camel-jms in the InOut same flo

    adrian.trenaman

      I have a camel route that listens on a CXFEndpoint (for MESSAGE data as DOMSource)  and routes the message to a JMS queue. Something like:

       

                 

       

      My understanding is that the JMS producer will realize that the exchange is InOut, create a temporary queue for the response, and then wait for the response to arrive on the temporary queue before sending the original CXFExchange on along the pipeline. Indeed, this is what I observe! However, I?ve discovered a little nasty.

       

      When the JMSProducer gets in the incoming message, it sets the Out message of the original CXFExchange to a JmsMessage. Then, the pipeline processor calls exchange.getOut on the CXFExchange and BANG! we get a class-cast exception. Turns out that the CXFExchange.getOut() method always casts the message to a CxfMessage. Ouch. Surely this means then that camel-cxf can?t talk to any producer that does not produce a CXFMessage - very limiting.

       

      Does anyone have some advice on how to get around this? Have I missed something?