LearningTech

Event-Driven

Poison Message Pattern

Description

Handling a message that consistently causes a consumer to crash or fail. The solution is usually to detect this and move it to a DLQ.

Where to use

  • Stability of consumers.

Real World Example

A malformed JSON packet causes the parser to throw an unhandled exception. The consumer catches this, marks it 'Poison', and discards it.

Code Example

class PoisonMessagePattern:
    def __init__(self):
        pass

    def execute(self):
        print('Executing Poison Message Pattern')