title: Read from multiple RabbitMQ exchanges in java client no polling
body: <p>Please explain how to configure a Java client to read from two different RabbitMQ exchanges without polling.  I would like the client to awaken when a message arrives, then block again.</p>
  
  <p>In my little system integration problem, one RabbitMQ exchange carries work messages using a variety of routing keys (I know how to use wildcards to catch them), and the other exchange carries control messages (e.g., "stop").  So my client has to listen to messages from both places.   This is a relatively low-volume system problem, I'm not asking about load sharing or fairness etc.</p>
  
  <p>Sure I could run a thread that polls each exchange, sleeps, dispatches, forever.  But I would like to avoid polling.</p>
  
  <p>I'm somehow reminded of the Unix select() system call that awakens when data is ready on any of the file descriptors handed to it.  Does RabbitMQ have something similar?</p>
  
  <p>My current solution is an adapter that spins up a thread to block on each input exchange; upon receipt each thread writes to a java.util.concurrent collection; and I use yet another thread to block on that collection and deliver messages as they arrive to the ultimate consumer.  It works fine but if I can chop out this complexity, that would be great.</p>
  
  <p>These SO posts dance around the issue, please feel free to rub my nose in the solution if I've overlooked it in these posts:</p>
  
  <p>For java:
  <a href="https://stackoverflow.com/questions/18531072/rabbitmq-by-example-multiple-threads-channels-and-queues">RabbitMQ by Example: Multiple Threads, Channels and Queues</a></p>
  
  <p>For C#:
  <a href="https://stackoverflow.com/questions/6696694/reading-from-multiple-queues-rabbitmq">Reading from multiple queues, RabbitMQ</a></p>
  
  <p>Thanks in advance.</p>