4 Replies Latest reply on Nov 24, 2008 5:54 PM by anil.saldhana

    Topics/Queues as MC Beans

    anil.saldhana

      I tried the following:

      <bean name="QueueEJB3MDB" class="org.jboss.mq.server.jmx.Queue">
       <property name="destinationManager">jboss.messaging.destination:service=Queue,name=QueueEJB3MDB</property>
       <property name="JNDIName">QueueEJB3MDB</property>
       <property name="serverPeer">jboss.messaging:service=ServerPeer</property>
       <depends>jboss.messaging:service=PostOffice</depends>
       </bean>
      


      reusing Scott's delegating bean
      http://anonsvn.jboss.org/repos/jbossas/trunk/messaging/src/main/org/jboss/mq/server/jmx/Queue.java

      All this does is delegation to the JBoss Messaging Destination MBean Service.

      The issue that I faced was that between the create() and start() calls on the Queue MC bean, there was no MBeanRegistration thereby no preRegister callback, such that the JBossMessaging mbean service could get hold of the mbean server. Because of this, the start() of the JBoss Messaging service fails with NPE because it has not got hold of the mbean server.

      If this is the same as the other thread, then forgive me.
      I did not want to digress the topic.
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=146039

      Certainly we can create the destinations the mbean way. But I wanted to give the mc bean way a try.

        • 1. Re: Topics/Queues as MC Beans
          anil.saldhana

          I think I have the mbean name wrong. There probably lies the issue. :(

          • 2. Re: Topics/Queues as MC Beans

             

            "anil.saldhana@jboss.com" wrote:
            I think I have the mbean name wrong. There probably lies the issue. :(


            Nope. Try this:
            <?xml version="1.0" encoding="UTF-8"?>
            
            
            <deployment xmlns="urn:jboss:bean-deployer:2.0">
            
            
             <bean name="QueueEJB3MDB" class="org.jboss.mq.server.jmx.Queue">
             <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.messaging.destination:service=Queue,name=QueueEJB3MDB", exposedInterface=org.jboss.mq.server.jmx.QueueMBean.class, registerDirectly=true)</annotation>
             <property name="JNDIName">QueueEJB3MDB</property>
             <property name="serverPeer">jboss.messaging:service=ServerPeer</property>
             <depends>jboss.messaging:service=PostOffice</depends>
             </bean>
            
            </deployment>
            


            which creates the POJO but makes sure it also gets registered with JMX
            so not much different from the mbean really.

            AFAIK the version of jboss messaging in jboss5 hasn't been "pojoized"
            but there is a later version that has.

            • 3. Re: Topics/Queues as MC Beans

              The version of the wrapper you are using is meant as a backwards compatiblity thing
              for people that have old jbossmq configurations but want to use jboss messaging
              without having to redo their destination configurations.

              If you're doing it from scratch, you should use the QueueService directly.

              • 4. Re: Topics/Queues as MC Beans
                anil.saldhana

                Thanks Adrian. I figured out that I was missing a JMX annotation and was trying to figure out how to convert the exposedInterface as a class instance from the xml file. :) Thanks for the example and I learned it.

                I will directly use QueueService.