Enable/disable loading of MDBs OR ignore deployment error if MDB cannot connect to the server



[environment: java ee 6, jms 1.1, wildfly 10, wmq 9]

I have to set up 9 Message Driven Beans that listen to different topics on 3 different servers:

  • 1 Topic in DEV
  • 4 in PROD
  • 4 in TEST (one for each in PROD)

The problem is that the topics are restricted to their respective servers, meaning that if for instance I deploy the TEST and PROD beans in DEV, I get a connection error and the deployment fails. Same if I deploy the DEV and PROD beans from TEST etc.
It only works if I ‘comment out’ the beans belonging to the other zones. It is obviously not a solution because the same code has to be deployed to all servers.

So I am desperately trying to find a way to somehow externally enable/disable the beans, depending on which server the application is deployed in.

… OR to somehow ignore if a bean could not connect, so the deployment is still successful and does not affect the listeners of the respective server.

Also open to any other idea on how to tackle this.

Thanks in advance!

Answer

I recommend either using the the active element in the MDB’s jboss-ejb.xml deployment descriptor or the @DeliveryActive annotation on the MDB itself. If you use the latter then you can activate the MDB administratively via the CLI if necessary. See the documentation for more details.



Source: stackoverflow