• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

how to slow down JMS

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can slow down by cutting number in the pool ( at setup time for the Listner Port) or by using transactions.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use MDB but write your own class to read out from queue and process.
Schedule this process to run periodically.
../Mel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic