Design Patterns (GoF) (50 Qs)•Part 3: Architectural Patterns & Enterprise Systems (25 - 35)
Competing Consumers Pattern: Scalable concurrent message processing.
mid Leveldesign-patternsArchitectural Patterns
In Simple Words: When the message production rate exceeds the processing capacity of a single consumer:
- Multiple identical consumer instances attach to a single shared message queue (RabbitMQ queue, AWS SQS).
- The message broker dispenses each message to strictly one consumer in the pool.
- System scales horizontally: add more consumer pods during traffic surges to drain queues faster with zero application code changes.