rabbit-client | 🐰 a simple and easy to use android apm framework | Code Inspection library
kandi X-RAY | rabbit-client Summary
kandi X-RAY | rabbit-client Summary
🐰 a simple and easy to use android apm framework (tools)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rabbit-client
rabbit-client Key Features
rabbit-client Examples and Code Snippets
Community Discussions
Trending Discussions on rabbit-client
QUESTION
I'm trying to see difference between DirectMessageListener
and SimpleMessageListener
. I have this drawing just to ask if it is correct.
Let me try to describe how I understood it and maybe you tell me if it is correct.
In front of spring-rabbit
there is rabbit-client
java library, that is connecting to rabbit-mq server and delivering messages to spring-rabbit library. This client has some ThreadPoolExecutor
(which has in this case I think - 16 threads). So, it does not matter how many queues are there in rabbit - if there is a single connection, I get 16 threads. These same threads are reused if I use DirectMessageListener
- and this handler method listen
is executed in all of these 16 threads when messages arrive. So if I do something complex in handler, rabbit-client
must wait for thread to get free in order to get next message using this thread. Also if I increase setConsumersPerQueue
to lets say 20, It will create 20 consumer per queue, but not threads. These 20*5 consumers in my case will all reuse these 16 threads offered by ThreadPoolExecutor
?
SimpleMessageListener
on the other hand, would have its own threads. If concurrent consumers == 1 (I guess default as in my case) it has only one thread. Whenever there is a message on any of secondUseCase*
queues, rabbit-client
java library will use one of its 16 threads in my case, to forward message to single internal thread that I have in SimpleMessageListener
. As soon as it is forwarded, rabbit-client
java library thread is freed and it can go back fetching more messages from rabbit server.
ANSWER
Answered 2019-Nov-05 at 16:11Your understanding is correct.
The main difference is that, with the DMLC, all listeners in all listener containers are called on the shared thread pool in the amqp-client (you can increase the 16 if needed). You need to ensure the pool is large enough to handle your expected concurrency across all containers, otherwise you will get starvation.
It's more efficient because threads are shared.
With the SMLC, you don't have to worry about that, but at the expense of having a thread per concurrency. In that case, a small pool in the amqp-client will generally be sufficient.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rabbit-client
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page