Hi I have made a small change in TOMEE-2149. The spec actually states the application server should allow the resource adapter to not deliver a message between calling beforeDelivery and afterDelivery, so I have adjusted the logic accordingly. The relevant paragraph from section 13.5.6 from JSR-322 is:
"There must not be more than one message delivery in-between a single beforeDelivery and afterDelivery method call pair. The application server must reject beforeDelivery or afterDelivery calls that are out of sequence by throwing an IllegalStateException. The application server must also allow a resource adapter not to perform any message delivery in-between a single beforeDelivery and afterDelivery method call pair. This scenario arises, for instance, when a resource adapter first chooses to deliver a message and calls beforeDelivery, but later is unable to deliver the message (for example in the case of JMS resource adapters, the resource adapter may abort the message delivery and transfer the message to a Dead Message Queue). The resource adapter must be able to call afterDelivery and complete the delivery cycle. The application server must perform any possible cleanup of actions that occurred in between the beforeDelivery and afterDelivery method calls." Any feedback is welcome. Please let me know if you have any queries or concerns. Thanks Jon
