# Message Filter

> Drop messages that do not match — only let through what the consumer actually cares about.

- **Category**: Integration
- **Subcategory**: Message Routing
- **Canonical URL**: https://designpattern.fyi/patterns/message_filter/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Fraud detection system subscribes to all transaction events but only processes transactions over $10,000. Message Filter drops everything below that threshold. Fraud team is not overwhelmed by noise from micro-transactions.





## Trade-offs


### Advantages

- Reduces unnecessary consumer processing — only relevant messages get through

- Simple to implement as a Pipes-and-Filters step

- Consumer logic stays clean — no if/else guards needed in the business handler

- Filters are composable and reusable




### Considerations & Drawbacks

- Mis-configured filter silently drops valid messages — needs monitoring

- Filter adds a processing hop and some latency

- Filter logic must be kept in sync with message schema changes

- No built-in DLQ for dropped messages by default







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

