2 Replies Latest reply on Feb 25, 2017 2:05 PM by lauradp

    Configurable MDB

    lauradp

      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,

      Laura

        • 1. Re: Configurable MDB
          mnovak

          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:

          spec-descriptor-property-replacement

          jboss-descriptor-property-replacement

           

          Thanks,

          Mirek

          1 of 1 people found this helpful
          • 2. Re: Configurable MDB
            lauradp

            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.