5 Replies Latest reply on Jun 21, 2007 6:54 AM by am_malu

    register mdb on queue

    hoeft

      Hi!

      I am reading the book an I haven't found how to register a MDB on a queue.
      I have found some examples in the internet which registers the MDB with the "destination" (JBOSS) property or "destinationName" property (Oracle). Is there a standard-compliant-procedure to register mdb's?

      Thanks
      Meinert

        • 1. Re: register mdb on queue
          wolfc

           

          EJB3 Core 5.4.16.1
          A JMS message-driven bean is associated with a JMS Destination (Queue or Topic) when the bean is
          deployed in the container. It is the responsibility of the Deployer to associate the message-driven bean
          with a Queue or Topic.


          In short: no.

          • 2. Re: register mdb on queue
            hoeft

            :-(((((

            Thanks a lot
            Meinert

            • 3. Re: register mdb on queue
              oly

              The short answer is implement the interface

              javax.jms.MessageListener
              and add the annotation
              @MessageDriven
              to your class. Here's an example:

              @MessageDriven(activateConfig = {
               @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
               @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/MyMDBQueue")
              })
              // NOTE: the EJB3 JSR says this class must not be final
              public class MyMDB implements MessageListener {
              
               private static final Logger l = Logger.getLogger(MyMDB.class);
              
               // NOTE: the EJB specification says we must have a public constructor with no arguments
               public MyMDB() {
               // to support spec
               }
              
               // NOTE: the EJB specification says this method must not be final
               public void onMessage(final Message message) {
               l.debug("*********** GOT MESSAGE: " + message);
               }
              }
              


              Thats it, the end, simple ... until you get into persistence and security a bit more.

              • 4. Property for setting MDB maximum pool size?
                vmarco

                What is the property for setting the maxium MDB pool size?

                I have tried both:

                @ActivationConfigProperty(propertyName = "maximumSize", propertyValue = "20"),


                and

                @ActivationConfigProperty(propertyName = "maxPoolSize", propertyValue = "20"),


                but to no avail.

                • 5. Re: register mdb on queue
                  am_malu

                  In the annotation Oracle wants destinationName and jboss wants destination.

                  Can I use something which both app server would be happy with.

                  @MessageDriven(activationConfig={
                  @ActivationConfigProperty(propertyName="destination", propertyValue="queue/ServiceInvocationQueue"),
                  @ActivationConfigProperty(propertyName="destinationName", propertyValue="queue/ServiceInvocationQueue"),
                  @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue")
                  })

                  Jboss throws error when I have this.