Hi, I am trying to get working the JMS message redelivery in CXF 2.7.X and CXF.3.0.0. Use case: CXF client sends JMS message to the service one-way operation. Business implementation of oneWay method throws runtime exception. Expected: message will be redelivered according RedeliveryPolicy and finally placed in dead queue, if all attempts are failed.
In CXF 3.0.0 this works successfully, basically it is enough to set sessionTransacted property of the JMSListener (via JMSConfiguration) to true and configure RedeliveryPolicy in ActiveMQ ConnectionFactory. In CXF 2.7.X the problem is that JMSDestination onMessage() method (is JMS listener) doesn't throw exception, because of the following check: //need to propagate any exceptions back to Spring container //so transactions can occur if (inMessage.getContent(Exception.class) != null && session != null) { PlatformTransactionManager m = jmsConfig.getTransactionManager(); if (m != null) { TransactionStatus status = m.getTransaction(null); JmsResourceHolder resourceHolder = (JmsResourceHolder) TransactionSynchronizationManager .getResource(jmsConfig.getConnectionFactory()); boolean trans = resourceHolder == null || !resourceHolder.containsSession(session); if (status != null && !status.isCompleted() && trans) { Exception ex = inMessage.getContent(Exception.class); if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException)ex.getCause(); } else { throw new RuntimeException(ex); } } } } resourceHolder.containsSession(session) always finds session and returns true => exception is never thrown from onMessage => message will not be redelivered. The sessionTransacted is set to true and spring transaction manager JmsTransactionManager is configured in JMSConfiguration. Does anybody know the sense of resourceHolder.containsSession(session) check in the code? Regards, Andrei.