# Content Filter

> Strip out what the receiver does not need — send only the relevant slice.

- **Category**: Integration
- **Subcategory**: Message Transformation
- **Canonical URL**: https://designpattern.fyi/patterns/content_filter/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
GDPR compliance in event streaming — a UserActivityEvent contains userId, sessionData, device info, and raw IP. Content Filter for the analytics topic removes raw IP (PII). Analytics consumers get everything they need for behavior analysis without any PII exposure.





## Trade-offs


### Advantages

- Reduces message payload size — lower broker bandwidth and consumer memory

- Prevents unintended PII or sensitive data exposure to downstream services

- Simplifies consumer logic — they only see what they need

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




### Considerations & Drawbacks

- Filter must be maintained as source schema evolves

- Over-filtering removes data that consumers end up needing later

- Multiple filter variants (per consumer type) multiplies maintenance effort

- Irreversible — stripped data cannot be recovered downstream







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

