title: RabbitMQ-based message driven bean in GlassFish
body: <p>I'm building a system which uses RabbitMQ as a messaging solution for its components. However I've got some legacy EJB Java code which does disk IO-intensive tasks on GlassFish app server as EJB. I would not like to re-write that code, so I would like to find a way to communicate with it. I know I could just use RabbitMQ java client, but I'm not sure how I would deal with message throttling, I don't want more than, say, 4 tasks running at the same time which is comparatively easy to do with message driven beans in GlassFish.</p>
  
  <p>The only thing I came up with is a singleton EJB that starts a timer in PostConstruct and upon that timer enters blocking AMQP client receive loop. I might then just copy AMQP messages received into local GlassFish JMS provider and poll them with MDB, but I don't like this because I would have to monitor several GlassFish JMS providers to find out how things are going, instead of just checking up on RabbitMQ.</p>
  
  <p>I'm struggling to find any information on how to interconnect AMQP and JMS, has anyone been doing anything like that before? Any ideas are appreciated.</p>