Message Acknowledgment

The interface specification for JMS requires that message delivery be guaranteed under many, but not all, circumstances.

The following figure illustrates the basic structure of message delivery and acknowledgment.

The following describes the steps in message delivery and acknowledgment:

  1. A message is sent from the message producer to the machine on which the EMS server resides.
  2. For persistent messages, the EMS server sends a confirmation to the producer that the message was received.
  3. The server sends the message to the consumer.
  4. The consumer sends an acknowledgment to the server that the message was received. A session can be configured with a specific session mode that specifies how the consumer-to-server acknowledgment is handled. These session modes are described below.
  5. In many cases, the server then sends a confirmation of the acknowledgment to the consumer.

The JMS specification defines three levels of acknowledgment for non-transacted sessions:

  • CLIENT_ACKNOWLEDGE specifies that the consumer is to acknowledge all messages that have been delivered so far by the session. When using this mode, it is possible for a consumer to fall behind in its message processing and build up a large number of unacknowledged messages.
  • AUTO_ACKNOWLEDGE specifies that the session is to automatically acknowledge consumer receipt of messages when message processing has finished.
  • DUPS_OK_ACKNOWLEDGE specifies that the session is to "lazily" acknowledge the delivery of messages to the consumer. "Lazy" means that the consumer can delay acknowledgment of messages to the server until a convenient time; meanwhile the server might redeliver messages. This mode reduces session overhead. Should JMS fail, the consumer may receive duplicate messages.

EMS extends the JMS session modes to include:

Warning: The Simplified JMS API introduced in JMS 2.0 supports the session modes defined in the JMS specification: CLIENT_ACKNOWLEDGE, AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, and SESSION_TRANSACTED. However, it does not support the EMS extended session modes.

The session mode is set when creating a Session, as described in Create a Session.