Competing Consumers Pattern

Problem

In Event based communication, client instances can simply publish the messages on a message system which can be processed by a consumer service. This solution works well till the number of requests are limited which can be handled by single instance of consumer service. But the problem arises when there is a need to handle a greater number of requests which cannot be handled by a single instance of the consumer service results in overloaded message system.

Solution

Greater number of requests can be handled by running multiple instances of the consumer service. However, it doesn’t guarantee that each message is only delivered and processed by a single consumer instance and doesn’t do the load balancing across consumer service instances. This can be easily resolved by implementing message queue pattern with multiple instances of the consumer service.
Please share this

Leave a Reply