liveBook · Manning

Poison message

As explained in C# Concurrency: Asynchronous and multithreaded programming

A poison message is a message that repeatedly fails processing and may prevent normal queue consumption unless it is isolated or discarded.

A poison message repeatedly crashes or fails processing. With at-least-once delivery, leaving it in the queue can create an endless restart loop: read, fail, restart, and repeat. section 8.2.3

Protect consumption with failure monitoring, such as a try-catch around processing. After repeated failures for the same message, remove it from the main queue and preserve it for inspection. section 8.2.3

Use these safeguards:

  • Move poison messages to another persistent queue, commonly called a dead letter queue, so the payload and underlying bug can be investigated. section 8.2.3
  • Prepare or validate messages before enqueueing them so one malformed item does not disrupt an entire operation. section 8.2.3
  • Account for poison messages when choosing persistent-queue delivery semantics, especially at-least-once delivery. section 8.3

How C# Concurrency: Asynchronous and multithreaded programming covers it

How deep it goes
Explains the restart loop and quarantine response, but does not specify retry thresholds or a complete implementation.
Examples
Uses a crashing queue item, a try-catch monitor, and a separate persistent queue for failed messages.
What it assumes
Assumes familiarity with background processing, queues, crashes, and at-least-once delivery.
What you can do after
Diagnose queue stalls by identifying repeated failures and isolating the offending message for inspection.
How it connects
Connects poison messages with persistent queues, at-least-once delivery, failure handling, and dead letter queues.

Also explained in

Compare how 2 books explain poison message →

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.