Hi, I'm building an application which gets its requests from a JMS queue. The problem I'm currently facing is that the JMS calls the onMessage() method faster than the application can handle the requests. Therefore I'm looking for a way to slow down the rate of the onMessage()calls. Preferably without slowing JMS in general, since this application is not the only application connecting to the JMS. Hope that anyone has some usefull hint for this problem. Thanks in advance PS. slowing down the message supplier is not an option. Rikko
Joined: Feb 02, 2004
You can slow down by cutting number in the pool ( at setup time for the Listner Port) or by using transactions.
Joined: Jan 23, 2002
I see two other options: 1) Use a separate scheduler queue to trigger your MDB, and let the MDB read messages from the original queue using raw JMS. This approach let's you control the rate of message consumption more flexibly. 2) Have the MDB sleep for a while before consuming the next message. I.e. use Thread#sleep(long) before returning from the onMessage() method). This is actually forbidden by the specification, but should work regardless.