0 votes
in Azure by
Explain the difference between At-most-once vs At-least-once message processing in Azure Service Bus

1 Answer

0 votes
by

At-most-once message processing means that for each message sent, the side effects of its processing may either be missing or applied once.

Consider a scenario in which the consumer issues the received request and then crashes before processing it. The Service Bus marks the message as consumed and the application begins consuming messages upon restart. And the app will miss processing the message that it consumed before the crash. The corresponding receiving mode in ASB is called Receive and delete.

In contrast at-least-once message processing means that the side effects may be applied multiple times but they may never be skipped.

If the application fails to process the message before the lock timeout expires, Service Bus unlocks the message and makes it available to be received again. If the application crashes after it processes the message, but before it requests the Service Bus service to complete the message, Service Bus redelivers the message to the application when it restarts.

Finally, exactly-once message processing means that the side effects are guaranteed to be applied once. Exactly once is the most difficult delivery semantic to implement. It is friendly to users, but it has a high cost for the system’s performance and complexity. Exactly once is especially important when duplication is not acceptable and the downstream service or third party doesn’t support idempotency.

...