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
- 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).
- 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).
- 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.
- 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.
PubSub+ Messaging API | Session Event |
---|---|
JCSMP |
|
Java RTO |
|
C |
|
.NET |
|
JavaScript and Node.js |
|
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).
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 |