multithreading - How to properly implement RabbitMQ RPC from Java servlet web container? -


i'd incoming java servlet web requests invoke rabbitmq using rpc approach described here.

however, i'm not sure how reuse callback queues between requests, per rabbitmq tutorial linked above creating new callback queue per every request inefficient (rabbitmq may not cope if using queue ttl feature).

there 1-2 rpc calls per every servlet request, lot of servlet requests per second.

i don't think can share callback queues between threads, i'd want @ least 1 per each web worker thread.

my first idea store callback queue in threadlocal, can lead memory leaks.

my second idea store them in session, not sure serialize , sessions not replicated/shared between web servers, imho not solution.

my infrastructure tomcat / guice / stripes framework.

any ideas robust/simple solution is?

am missing in whole approach, , over-complicating things?

note 1- question relates overall business case described here - see option 1.

note 2 - there seemingly related question how setup rabbitmq rpc in web context, concerned proper shutdown of threads created rabbitmq client.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -