I have implemented @JmsListener
to listen the messages from Producer.
APP <- Consumer <- Producer
So, as shown above Consumer
is consuming messages from producer and calling application(APP) to process those messages, in this case application is slow and we wanted to limit the rate of messages we are consuming from queue (Consumer <- Producer)
@JmsListener(
containerFactory = XXX destination = XXX) public void receive(Message message) throws JMSException {
}
Finding the way to limit the rate of messages from Producer, It can be done by limiting subscription or something with concurrency but not find any support @JmsListener
annotation
There is a @JmsListener concurrency option:
The concurrency limits for the listener, if any. Overrides the value defined by the container factory used to create the listener container.
The concurrency limits can be a "lower-upper" String — for example, "5-10" — or a simple upper limit String — for example, "10", in which case the lower limit will be 1.
Note that the underlying container may or may not support all features. For instance, it may not be able to scale, in which case only the upper limit is used.