-1

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.

user5919369
  • 111
  • 6
  • It may be helpful if you describe your problem in more detail. Someone may be able to come up with a better mechanism. Is JMS part of your solution or one of your requirements? – Steve C Nov 27 '17 at 13:50
  • The JMS is a requirement. – user5919369 Nov 27 '17 at 13:53
  • I need to take charge of requests using a WS that write on a JMS queue. The process that dequeue from this JMS queue must have a throttling control – user5919369 Nov 27 '17 at 13:54

1 Answers1

0

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.

user3714601
  • 1,156
  • 9
  • 27