multithreading - RabbitMQ channels and threads in Java client -



multithreading - RabbitMQ channels and threads in Java client -

i'd quick confirmation of suspect part of rabbitmq documentation says:

callbacks consumers dispatched on thread separate thread managed connection. means consumers can safely phone call blocking methods on connection or channel, such queuedeclare, txcommit, basiccancel or basicpublish.

each channel has own dispatch thread. mutual utilize case of 1 consumer per channel, means consumers not hold other consumers. if have multiple consumers per channel aware long-running consumer may hold dispatch of callbacks other consumers on channel.

i have various commands (messages) coming in through single inbound queue , channel has defaultconsumer attached it. right assume there threadpool in defaultconsumer lets me run application logic straight off consumer callback method, , i'm not blocking processing of later commands? , if seems there's bottleneck, can give rmq bigger threadpool?

in addition, there basicpublish same channel other threads. take hold consumers? guess should create utilize of new channel when doing this?

the thread pool mentioned not part of defaultconsumer rather part of connection shared between channels , defaultconsumers. allows different consumers invoked in parallel. see this part of guide.

so expect increasing size of thread pool can reach higher level of parallelism. that's not factor influences it.

there's big caveat: incoming messages flowing though single channel processed serially no matter how many threads have in thread pool. it's way how consumerworkservice implemented.

so able consume incoming messages concurrently have either manage multiple channels or set messages separate thread pool.

publishes not utilize threads connections's thread pool not hold consumers.

for more details may check this post.

java multithreading rabbitmq

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -