cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Zethelius <sv...@expedia.com>
Subject CXF + Camel + JMS Endpoint exception handling
Date Wed, 08 Jun 2011 23:15:44 GMT
I've started playing with CXF + Camel + JMS, and have set up a sample client and service that
can put and get messages from a JMS Queue.

I've started going deeper to understand the transaction and retry logic since one of the use
cases I have is to use either the JMS or Camel retry logic to reprocess messages that threw
exceptions.  However, after debugging through, it appears the exception the thrown from my
service was eaten in ChainedMessageObserver and never gets back to org.apache.camel.component.cxf.transport.CamelDestination.incoming(Exchange).
 If I understand the overall flow of the retry logic, Camel needs to see the exception as
an exception on the camel Exchange in order to treat the message as failed.  In the CamelDestination
(camel-cxf), the cxf Exchange only exists for the CamelDestination.incoming scope, which means
the getContent(Exception) is lost with that exchange.  I think the bug is in CamelDestination
in that it should be checking the cxf Exchange for getContent(Exception.class) and forwarding
it to the camel Exchange so that the rest of Camel can see the Fault.

Is this a bug, or user error and there is another way exceptions should be handled here? 
I assume the work around would be a custom CXF interceptor that adds the Exception to camel
Exchange.  Any better work arounds?


        <jaxws:endpoint id="JMS_prototype.Server"
                implementor="com.expedia.cc.container.remoting.prototype.SampleServicePortTypeImpl"
                wsdlLocation="com.expedia.cc.samples.sampleservice.v2.contract.wsdl"
                address="${queue}">
                <jaxws:properties>
                        <!-- to force One way messages onto the onMessage thread -->
                        <entry key="org.apache.cxf.interceptor.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD"
value="true" />
                </jaxws:properties>
        </jaxws:endpoint>

        <bean class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
                <property name="bus" ref="cxf" />
                <property name="camelContext" ref="camelContext" />
                <property name="transportIds">
                        <list>
                                <value>http://cxf.apache.org/transports/camel</value>
                        </list>
                </property>
        </bean>

        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory" ref="jmsConnectionFactory.single" />
                <property name="useMessageIDAsCorrelationID" value="true" />
        </bean>

        <camel:camelContext id="camelContext">
        </camel:camelContext>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message