2.5.7 Receive Message in Transaction – Application

 Context of Use: This use case extends the use case described in Receive a Message from a Queue - Application (section 2.5.6) by adding transactional semantics to the message receive operation. In this use case, the application and the queue manager interact with a Transaction Coordinator to receive one or more messages in the context of a transaction. Whether the messages are consumed depends on the outcome of the transaction. The messages are removed from the queue only upon a successful outcome of the transaction. Conversely, the messages are returned back to the queue upon a failed outcome of the transaction.

 Goal: This use case receives one or more messages from a queue in the context of an atomic transaction.

 Actors

Application: See section 2.5.

Application Users: See section 2.5.

Transaction Coordinator:  See section 2.5.

 Stakeholders

Developers:  See section 2.5.

Testers: See section 2.5.

Application Users: See section 2.5.

 Preconditions

This use case has the following preconditions, in addition to those described in the extending use case in Receive a Message from a Queue – Application:

  • The Transaction Coordinator is accessible to the application as well as the queue manager in order to coordinate the transaction execution.

 Main Success Scenario

 Trigger: The direct actor triggers this use case based on the actions of the primary actor. It is also triggered by the Exchange Message - Application (section 2.5.8) use case.

The steps involved in this use case are similar to those in Receive a Message from a Queue – Application, with the exception of additional interactions with the Transaction Coordinator system. The combined steps are:

  1. The application creates a transaction and follows steps 1-4 of Receive a Message from a Queue – Application, to send each receive request to the queue manager under the context of the transaction.

  2. The queue manager enlists in the transaction if it has not enlisted in the transaction yet. For each receive request, if a message was available from the previous step, the queue manager locks the message and thereby makes it invisible outside the context of the transaction, as if the message has been temporarily removed from the queue. Each message is returned to the application for the corresponding receive request.

  3. The application commits or aborts the transaction, and the Transaction Coordinator communicates the outcome of the transaction to the resource manager facet of the queue manager. Upon a successful outcome of the transaction, the queue manager removes the messages from the queue. Conversely, upon a failed outcome, the queue manager undoes the receive operation and returns the messages back to the queue.

 Postcondition

  • If the outcome of the transaction is successful, the postcondition is the same as in Receive a Message from a Queue – Application.

  • If the outcome of the transaction is not successful, the messages are placed back in the queue.

 Extensions

None.