JMS flow control

127 views Asked by At

I need to create a JMS consumer for which I can dinamically set the dequeue rate, something like N message per minute/second.

If I use the message-driven beans I can control the pool size, but I can't introduce a wait in a clean way, I can use sleep, but I don't know if it is a good idea.

Some AS admit a flow-control for JMS, but it's not JEE standard. Maybe I could use timers service, but in this hypothesis I can't have an ejb pool, anyway not a pool controlled by the AS.

1

There are 1 answers

2
user3714601 On

Yes, you can use timer service for this purpose.

And you definitely can use timer service with stateless beans, which are pooled. You might need to check out more details here: https://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html

If you consider some parallel processing, or there are some other users of timer service on the same server - you have to provide timer service thread pool with sufficient number of threads.