I'm not sure whether I understand your requirement correctly. You want to consume the JMS no matter what happened during the processing. In other words, if processing fails message must still be consumed?
Instead of changing the transaction type, you could try the following:
1) Swallow all excetions raised during the processing, if the transaction context itself wa not invalidated message will be consumed.
2) If transaction context was invalided (e.g.: due to an error in the EntityManager), to swallow the exception will not be enough and transaction will fails. As a consequence, the app. server will usually attempt to re-deliver it later. But if you set EndpointExceptionRedeliveryAttempts to zero, the message should not be re-delivered and will go to the dead message queue (DMQ) instead. You can configure this with annotations:
@ActivationConfigProperty (
propertyName = "endpointExceptionRedeliveryAttempts",
propertyValue = "0"
), @ActivationConfigProperty (
propertyName = "sendUndeliverableMsgsToDMQ",
propertyValue = "true"
)
I'm not saying this is the best pattern in your case, but you could give it a try.
[Message sent by forum member 'ewernli' (ewernli)]
http://forums.java.net/jive/thread.jspa?messageID=355060