jakarta-eejmsejbibm-mqjboss6.x

MDB listening to a varying amount of IBM MQs


Here is my goal:

I have a Message-Driven Bean (class), which I want to deploy to a JBoss EAP 6 server. The MDB should listen to one or more external queues which I'll connect to using the corresponding JMS resource adaptor. We need to use JMS because we need to have that sweet shared transaction between the queue and the database connections.

The challenge is that we will need to hook the MDB with more queues later on, and we need to be able to do that, without creating a new deployment. So we're limited to changing configurations and restarting the server.

How could this be done?


Solution

  • I don't believe there is any way to do what you want, at least not directly. In your case, an MDB is tied to a single JMS destination. You would need to deploy a new/different MDB for every JMS destination from which you wanted to receive messages.

    I recommend deploying your MDB and having it listen to a "master" queue and then you can funnel all the messages from all the other destinations you care about into this one master queue. IBM MQ may have functionality to do this natively or you could potentially use something like Apache Camel.