Acknowledging Published Messages

Published Guaranteed messages are acknowledged when they are received by the Solace PubSub+ event broker. The following figure shows the publish and acknowledge process used for Guaranteed messages.

Acknowledging Published Guaranteed Messages

  1. A client application publishes messages with Persistent delivery modes over an established client Session.

    The maximum number of messages that a client application can publish before the messaging API must receive an acknowledgment from the event broker is limited by the Publish Window Size Session property (refer to Adjusting the Guaranteed Message Publish Window Size).

  2. After the event broker receives the Guaranteed messages, it returns positive acknowledgments to the API. This reopens the publish window so that the client application can continue to publish Guaranteed messages.

    By default, the event broker sends an acknowledgment for published messages when a threshold of either a third of the Publish Window Size is reached or one second has elapsed. These are non‑configurable thresholds on the event broker.

    In cases where you do not have a high-rate publisher, and you do not want to wait for either the acknowledgment threshold or time out, you can enable the Ack Immediately message property for each message so that the event broker sends an individual acknowledgment for each message it receives (refer to Ack Immediately).

  3. When the API receives the acknowledgment for the windowed messages, the publish window automatically reopens so that further messages can be published. (To prevent interruptions when publishing messages, the maximum window size should not be reached before the API receives an acknowledgment.)

    The session property Ack Event Mode determines whether the API receives an acknowledgment for each message (the default) or a single acknowledgment for multiple messages sent in the publish window (that is, a ranged acknowledgment). Refer to Setting a Message Acknowledgment Event Mode.

  4. The API provides the message acknowledgments to the client application through Session events:
    • When a WINDOWED Ack Event Mode is used, in the Session event a single ACK event acknowledges the last message sent (as referenced by its correlation ID) and implicitly acknowledges all of the preceding messages. Message rejection events remain explicit (that is, per message).
    • When a PER_MESSAGE Ack Event Mode is used, in the Session event an explicit acknowledgment or rejection of the message (as referenced by its correlation key) is provided for each message.

Session Events for Published Guaranteed Messages

PubSub+ Messaging API

Session Event

JCSMP

  • JCSMPStreamingPublishCorrelatingEventHandler.responseReceivedEx(...)
  • JCSMPStreamingPublishCorrelatingEventHandler.handleErrorEx(...)

Java RTO

  • SessionEventCode.ACKNOWLEDGEMENT
  • SessionEventCode.REJECTED_MSG_ERROR

C

  • SOLCLIENT_SESSION_EVENT_ACKNOWLEDGEMENT
  • SOLCLIENT_SESSION_EVENT_REJECTED_MSG_ERROR

.NET

  • SessionEvent.Acknowledgement
  • SessionEvent.RejectedMessageError

JavaScript and Node.js

  • solace.SessionEventCode.ACKNOWLEDGED_MESSAGE

  • solace.SessionEventCode.REJECTED_MESSAGE_ERROR

Setting a Message Acknowledgment Event Mode

This session property specifies whether message acknowledgment events that are returned to the client application should acknowledge individual published Guaranteed messages or a range of published Guaranteed messages (the acknowledgment for a given message implicitly acknowledges all preceding messages).

To Set the Message Acknowledgment Event Mode for a Session

PubSub+ Messaging API

Property

JCSMP

JCSMPProperties.ACK_EVENT_MODE

Java RTO

SessionHandle.PROPERTIES.ACK_EVENT_MODE

C

SOLCLIENT_SESSION_PROP_ACK_EVENT_MODE

.NET

SessionProperties.AckMode

JavaScript and Node.js

solace.sessionProperties.publisherProperties.acknowledgeMode