Is it possible to have multiple queue consumers on a single connection? I tried this creating multiple sessions but the messages often just go to the first listener I created on the queue and not the second.

Andreas Mueller

How many messages a consumer receives depends on the attribute "smqp-consumer-cache-size" of the connection factory you lookup. The default is a cache size of 500 messages. Multiple consumers are competing on queue messages. If a consumer cache is filled up, up to "smqp-consumer-cache-size" are consumed from the top of the queue.

Say, you have 2 consumers with the default cache size of 500 messages and your client processes those messages equally. Say further the queue contains 5000 messages. In this case, each consumer will get 2500 messages in 500-message-bulks.

Reducing the cache size will change the bulk size, however, it may decrease your throughput a lot! It's better to use a single consumer and process the messages on your client in different threads instead of having competing consumers on a queue.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact