Reputation: 568
Google's pub/sub service provides an endpoint for the subscriber of a message, to explicitly acknowledge the successful delivery of a message. If this endpoint is not used, then subscriber must return a 200 response before the timeout, otherwise pub/sub considers the message delivery unsuccessful, and will retry sending it after the timeout has elapsed. So for a long-running subscriber process, the acknowledgement can be sent first, before running the main process, rather than waiting until the process is completed.
I have not been able to find a similar mechanism in Azure Event Grid, so if event handler is taking a long time (according to documentation the timeout is just 30 seconds), then in the middle of the process, event grid retries sending more events to the same subscriber:
"Event Grid waits 30 seconds for a response after delivering a message. After 30 seconds, if the endpoint hasn’t responded, the message is queued for retry. Event Grid uses an exponential backoff retry policy for event delivery."
Isn't there really an explicit way of acknowledging successful receipt of an event in event grid? I have found a property named LongRunningOperationRetryTimeout in EventGridClient, but setting this property to a large value will delay the retries, when they are actually needed.
I know that I can use other mechanisms such as storage queues or durable functions, but I want to see available options with event grid before revamping my code.
Upvotes: 1
Views: 1545
Reputation: 25994
Event Grid does not acknowledge event delivery. From the publisher's point of view, it's not important as there should be no coupling between the publisher and the subscribers. If the subscriber is not available or cannot receive the event, Event Grid will retry. If the message is not deliverable, a dead-letter queue can be configured.
An alternative could be using a queue (Service Bus or Queue Storage) or a topic (Service Bus) as the handler. That way events are forwarded to the subscribers and messages are guaranteed to be delivered. See Service Bus as a handler and Queue Storage as a handler.
Upvotes: 1