+

Search Tips   |   Advanced Search

Strict message ordering with the WebSphere MQ messaging provider and message-driven bean (MDB) applications

Message ordering is important to some asynchronous messaging applications; that is, it is important to process messages in the same order that the producer sends them. If this type of message ordering is important to the application, the design must take it into account.

For example, a messaging application that processes seat reservations might have producer components and a consumer component. A producer component sends a message to the consumer component when a customer reserves a seat. If the customer cancels the reservation then the producer (or possibly a different producer) sends a second message. Typically, the consumer component must process the first message (which reserves the seat) before it processes the second message (which cancels the reservation).

Some applications use a synchronous (request-response) pattern where the producer waits for a response to each message before it sends the next message. In this type of application, the consumer controls the order in which it receives the messages and can ensure that this is the same order as the producer or producers send them. Other applications use an asynchronous (fire and forget) pattern where the producer sends messages without waiting for responses. Even for this type of application, order is usually preserved; that is, a consumer can expect to receive messages in the same order as the producer or producers send them, especially when there is a significant time between sending consecutive messages. However the design must consider factors that can disrupt this order.

The order of messages is disrupted if the application sends messages with different priorities (higher priority messages can overtake lower priority messages) or if the application explicitly receives a message other than the first by specifying message selectors. Parallel processing and error or exception processing can also affect message ordering.


Subtopics

  • Stabilized features
    WebSphere MQ library