Three-stage message receive
Original Publication Date: 2005-Jan-20
Included in the Prior Art Database: 2005-Jan-20
Three-stage message receive is a protocol for the receipt of messages from a messaging server by a managed runtime environment. In particular, it is intended for use by runtime envionrments that supports consumer mediations, which are additional objects that may modify the content of each message before it is seen by the target object, as well as performing arbitrary other transactional work in the context of the transaction that is used by the target object to receive the message. The purpose of three-stage message receive is to enable support for consumer mediations whilst still permitting the managed runtime environment to select a target objects to receive each message based on the pre-mediated message content, and in a different context to that of the transaction context, mediation, and receiving object.
Three-stage message receive
In a messaging system, applications receive messages by issuing a "receive"
request to a messaging server. In response to the receive request, the messaging
server delivers the message to the application, such that the application can view the
message content, and deletes the message from the server. In a transactional
messaging system, the receive request may be included in a unit of work containing
other transactional updates - the sending of a different message for example. In this
case, the application issues three or more requests to the messaging server:
start transaction t
Stage 1: receive message m in transaction t
// At this point the application can view the message content commit transaction t
// At this point the messaging server deletes the message
This is a single-stage transactional message receive, and is implemented widely in messaging products.
A two-stage message receive is also possible. The purpose of the two-stage receive is to allow a managed runtime environment built on top of the messaging system to select a target object to receive the message, based on the message content. For example, it is known to perform workload classification based on the message content; this results in a particular selection of Server Region in which the message will be received. The additional stage is needed because the despatch decision is made in a different context to that of the transaction context and receiving object. The two-stage receive looks like this: Stage 1: token k = view-and-reserve message
// At this point the managed runtime environment can view the //message content and select the target to receive the message // The message is hidden/locked such that it is not visible //to other receivers despatch to target object start transaction t
// This occurs in the context of the receiving object
Stage 2: delete message identified by token k in transaction t
// Only by supplyin...