Announcement Announcement Module
No announcement yet.
what is the difference between maxMessagesPerTask, prefetch and prefetch limit? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • what is the difference between maxMessagesPerTask, prefetch and prefetch limit?

    Hi, i am a little confused on what the difference is on all three:

    1. prefetch limit: according to this link :
    ActiveMQ uses a prefetch limit on how many messages can be streamed to a consumer at any point in time
    It saids that i can set this per consumer basis, and that i can set this to 0:
    Specifying a prefetch limit of zero means the consumer will poll for more messages, one at a time, instead of the message being pushed to the consumer.
    2. prefetch: one of the jms:listener-container properties.
    The maximum number of messages to load into a single session. Note that raising this number might lead to starvation of concurrent consumers!
    But when i set this to 0, i get an exception:
    Property 'maxMessagesPerTask' threw exception; nested exception is java.lang.IllegalArgumentException: 'maxMessagesPerTask' must not be 0
    So this brings me to me to the third property maxMessagesPerTask:

    3. maxMessagesPerTask:
    maximum number of messages to process in one task.
    So what is the differences between the three? and if they are the same - why can't i set the listener container to be 0.
    To be more specific: i want a consumer to receive one request at a time, and not receive one until finished processing the previous one. what is the best way to do this?


  • #2
    Sorry for not getting to this sooner. We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-jms tag.

    If you do post it there, please reply here with the link.