Re: CXF Inteceptor Error handling with Camel-CXF, JMS and ActiveMQ
Thanks, Willem. I had already started down this route, but had some trouble. I finally got it to work. The trick was to make sure that when the exception thrown/caught by CXF, that I propagated that exception back into the Camel route using another interceptor. The interceptor uses the following technique: public void handleException(final Message message) { Throwable exception = message.getContent(Exception.class); if (exception != null) { Exchange exchange = (Exchange) message.get(org.apache.camel.exchange); if (exchange != null) { exchange.setException(exception); } } } This way the Camel route recieves the exception and can process the message with an onException clause. Thanks, -g8torPaul -- View this message in context: http://camel.465427.n5.nabble.com/CXF-Inteceptor-Error-handling-with-Camel-CXF-JMS-and-ActiveMQ-tp5758297p5758453.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF Inteceptor Error handling with Camel-CXF, JMS and ActiveMQ
I think you can try to use camel transport of CXF[1], in this way the camel error handler can be use to help you the exception handler there. [1]http://camel.apache.org/camel-transport-for-cxf.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On October 29, 2014 at 9:41:16 PM, g8torPaul (paul.mann...@ventyx.abb.com) wrote: I have an inbound CXF webservice that consumes a SOAP message off a JMS queue. The endpoint is configured via Camel Spring using the org.apache.cxf.transport.jms.JMSConfigFeature. The JMS Configuration is setup to consume off an ActiveMQ JMS queue and it is transactional. The CXF endpoint has a inbound interceptor for WSSecurity. If a user sends in a SOAP message with invalid Security headers the CXF endpoint interceptor will throw an exception. The exception gets processed by the internal Spring DMLC used by the CXF JMSConfigFeature and a rollback is initiated. Since our ActiveMQ is setup with a redelivery policy to continuously redeliver the message, the message gets rolled back to the queue and gets redelivered. The problem is that the message gets another exception upon redelivery and repeats the cycle infinitely which results in blocking the JMS queue (which only has one a consumer). I am trying to figure out how to handle this special case of WSSecurity exceptions such that I can dump the message to a log and remove the message from the queue for redelivery. Camel Exception handling (errorHandler, onException) does not help in this case because the message never makes it into the route (the exception occurs in an interceptor). Does anyone know a way to handle this? Thanks, g8torPaul -- View this message in context: http://camel.465427.n5.nabble.com/CXF-Inteceptor-Error-handling-with-Camel-CXF-JMS-and-ActiveMQ-tp5758297.html Sent from the Camel - Users mailing list archive at Nabble.com.
CXF Inteceptor Error handling with Camel-CXF, JMS and ActiveMQ
I have an inbound CXF webservice that consumes a SOAP message off a JMS queue. The endpoint is configured via Camel Spring using the org.apache.cxf.transport.jms.JMSConfigFeature. The JMS Configuration is setup to consume off an ActiveMQ JMS queue and it is transactional. The CXF endpoint has a inbound interceptor for WSSecurity. If a user sends in a SOAP message with invalid Security headers the CXF endpoint interceptor will throw an exception. The exception gets processed by the internal Spring DMLC used by the CXF JMSConfigFeature and a rollback is initiated. Since our ActiveMQ is setup with a redelivery policy to continuously redeliver the message, the message gets rolled back to the queue and gets redelivered. The problem is that the message gets another exception upon redelivery and repeats the cycle infinitely which results in blocking the JMS queue (which only has one a consumer). I am trying to figure out how to handle this special case of WSSecurity exceptions such that I can dump the message to a log and remove the message from the queue for redelivery. Camel Exception handling (errorHandler, onException) does not help in this case because the message never makes it into the route (the exception occurs in an interceptor). Does anyone know a way to handle this? Thanks, g8torPaul -- View this message in context: http://camel.465427.n5.nabble.com/CXF-Inteceptor-Error-handling-with-Camel-CXF-JMS-and-ActiveMQ-tp5758297.html Sent from the Camel - Users mailing list archive at Nabble.com.