# Channel Purger

> Clear a channel of all messages — for testing, maintenance, or incident recovery.

- **Category**: Integration
- **Subcategory**: System Management
- **Canonical URL**: https://designpattern.fyi/patterns/channel_purger/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Post-incident recovery — a deployment bug published 100,000 malformed messages to a processing queue. Consumers are crashing on every message. Channel Purger is invoked to clear the queue, saving message copies to an audit store. Consumers resume processing clean messages after the fix is deployed.





## Trade-offs


### Advantages

- Fast resolution for poison message incidents that block processing

- Essential for test environment reset between test runs

- Controlled — explicit operation with a confirmation count

- Pair with Message Store to preserve purged messages for analysis




### Considerations & Drawbacks

- Irreversible if messages are not backed up first — data loss risk

- Must be access-controlled — unauthorized purge of production is catastrophic

- Purging a live production channel mid-flow can cause data inconsistency

- Does not fix the root cause — just clears the symptom







---
**Reference**: [Original Source](https://www.enterpriseintegrationpatterns.com/patterns/messaging/ChannelPurger.html)

