liveBook · Manning

At-least-once delivery

As explained in C# Concurrency: Asynchronous and multithreaded programming

At-least-once delivery is a message-delivery guarantee that permits duplicates but ensures a message is delivered one or more times.

At-least-once delivery removes a message only after processing finishes. A crash between processing and removal can therefore cause the same message to be processed again. section 8.2.3

Choose the guarantee by weighing duplicate work against lost data:

  • Prefer at-least-once delivery when losing data is worse than processing an item twice. section 8.2.3
  • Expect a poison message to create a restart-and-crash loop unless processing failures are monitored and handled. section 8.2.3 section 8.3
  • Use a persistent queue when work must survive a program crash; available options include a database, RabbitMQ, AWS SQS, and Azure Storage Queues. section 8.3

Mail merge after a lost confirmation

If a mail server connection fails after sending but before confirmation, the sender cannot know whether the message arrived. Retrying risks a duplicate; skipping risks losing the message, so exactly-once delivery is usually unavailable. section 8.2.3

How C# Concurrency: Asynchronous and multithreaded programming covers it

How deep it goes
Explains removal timing, crash windows, delivery trade-offs, and poison-message loops without detailing queue-provider implementations.
Examples
Uses a mail merge, a lost confirmation, and a crash between processing and queue removal as concrete failure scenarios.
What it assumes
Assumes familiarity with persistent queues, crashes, and separating message removal from processing.
What you can do after
Operate persistent queues by selecting at-least-once delivery and planning monitoring for messages that repeatedly crash processing.
How it connects
Connects persistent queues with at-most-once delivery, exactly-once delivery, and poison messages.

Also explained in

Compare how 4 books explain at-least-once delivery →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of C# Concurrency: Asynchronous and multithreaded programming. The section links point to the parts of the book it draws on.