EIPinCPI – Competing Consumers
This week, we’ll study a pattern known as Competing Consumers.
When do I use this pattern?
This pattern is used when the message creation is faster than the message consumption and performance is important. In this pattern, Consumers compete with each other to consume the message, therefore the pattern is named Competing Consumers.
Competing Consumers in CPI
In CPI, the Competing Consumers pattern is easily implemented by setting the Number of Concurrent Processes configuration in JMS Sender Adapter
In the example, the integration flow only consumes the message and logs it.
These configurations have been changed for JMS Sender Adapter as follows:
|Number of Concurrent Processes||5|
Competing Consumers pattern is applied when consuming the message one by one becomes a bottleneck. When message consumption is slower than message creation, applying the Competing Consumers pattern can speed up the consumption.