Enabling Acknowledgement
Enabling Acknowledgement
Consumers consume messages from the Events service after creating a subscription to an event using either HTTP or WebSocket protocol. This section deals with the acknowledging messages consumed through the HTTP protocol.
The Events service version 2.0 incorporates the acknowledgement feature for both message-level and batch-level acknowledgements.
Consume API with acknowledgement configuration
The HTTP Consume API of the Events service includes an acknowledgement configuration, as detailed in the API reference. Consumers have the option to enable or disable acknowledgement using the explicitAck query parameter.
The Events service offers flexibility by allowing consumers to set the wait time for acknowledgement using the visibilityTimeout query parameter. For example, if a consumer needs 1 minute to process a received message, they can set the visibilityTimeout query parameter to 60000. In this period, the consumer is expected to send the acknowledgement within 1 minute after the message is received.
It’s important to note that both explicitAck and visibilityTimeout can vary for each consume API request. Consumers must include these parameters as query parameters in the consume API request, as specified in the API reference.
Acknowledge Event API
Consumers use the Acknowledge API to send acknowledgement to the Events service.
When a consumer polls a message with explicitAck set to true, Event Service waits for an acknowledgement for the delivered messages.
The consumer API’s response structure includes both the batchAckId and ackId for every message, as specified in the API reference. Consumers should send either batchAckId (bach-level) or ackId (message-level) in the ackId field of the Acknowledge API.
When the acknowledgement is received by the Events Service, the message/batch is considered delivered successfully. In the case where the consumer fails to send the acknowledgement, messages will be reprocessed as per Consumer Failure Retry Policy