2 Replies Latest reply on Feb 25, 2017 2:05 PM by Laura delli Paoli

    Configurable MDB

    Laura delli Paoli Master

      Hello everybody,

      I need a way of instantiating a Message Driven Bean configuring at system start-up time activation config properties (e.g. queue name, selectors and likely the number of bean instances to allocate).


      When looking-up queues form remote hosts I'm able to accomplish this goal by doing:


      queue = (Queue) ctx.lookup(queueName);

      qReceiver = qsession.createReceiver(queue);

      qReceiver.setMessageListener(new ListenerClass());


      and likely to perform this operation n times if I need n consumers to be listening on the queue.


      Is there any way of setting up MDB configuration when at system start up (likely in a startup servlet)?


      Thanks in advance,


        • 1. Re: Configurable MDB
          Miroslav Novak Master

          Hi Laura,


          it's possible to set activation config property from system property like:

          @MessageDriven(name = "mdb1",
            activationConfig = {
             @ActivationConfigProperty(propertyName = "destination", propertyValue = "${jms.queue.testQueue}"),


          and start server by:

          sh standalone.sh -c standalone-full-ha.xml "-Djms.queue.testQueue=jms/queue/testQueue"


          To make this work it's required to enable annotation-property-replacement in server:

          [standalone@localhost:9990 /] /subsystem=ee:write-attribute(name=annotation-property-replacement,value=true)


          The same replacement can be done also in deployment descriptors for your MDB. The attributes in "ee" subsystem which enable it are:






          1 of 1 people found this helpful
          • 2. Re: Configurable MDB
            Laura delli Paoli Master

            Thanks Mirek, I was looking for something more flexible (like looking-up the some consumer on more than one queue) so I used standard consumers.