A pattern that has proven to be very useful when building distributed systems is the use of transactional durable queues to provide store-and-forward asynchronous message delivery. In this pattern, atomic transactions are exploited at each of the transmission endpoints. At the sender side, the sending application delivers a message to a durable queue in an atomic transactional manner in which the application and the queue manager both use WS-AtomicTransaction to coordinate. The message is considered successfully delivered to the queue only if there is no processing exception.
Then, the queue subsystem takes over the delivery of the message between the originating queue and the recipient queue. This transmission step can be done at a time that is different from that when the message was placed in the originating queue. In addition, the location of the originating queue need not coincide with the location of the application from which the message originated.
Analogously, the application that retrieves the message from the recipient queue does so using atomic transactions. In that manner, a message can be retrieved from the queue only when there are no processing errors.