9 Replies Latest reply on Jul 14, 2009 12:47 PM by timfox

    Creation of topic @ runtime

    desuraghu

      I want to create a topic at runtime.

      In Jboss messaging 1.2 version I am able to create using ServerPeerMbean. But the same is not available in the 1.4.4 version.

      Can any one help me in resolving this issue. In JBM 1.4.4 version how can we create a topic/queue at runtime.

      Regards,
      Raghu

        • 1. Re: Creation of topic @ runtime
          gaohoward

          Hi, you need use jmx interface. for example:

          MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
          
           ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
          
           String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
          
           mBeanServer.invoke(serverObjectName, "deployQueue",
           new Object[] {queueName, jndiName},
           new String[] {"java.lang.String", "java.lang.String"});
          



          • 2. Re: Creation of topic @ runtime
            desuraghu

            Is there any other alternative to get ServerPeer MBean instance.

            For ex :
            ---------
            MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
            ObjectName objectName = new ObjectName( "jboss.mq:service=DestinationManager");

            mBean = (DestinationManagerMBean) MBeanServerInvocationHandler
            .newProxyInstance(mbeanServer, objectName,
            DestinationManagerMBean.class, false);


            • 3. Re: Creation of topic @ runtime
              timfox

              In both 1.2 and 1.4 the ServerPeer should be visible in the jmx-console in a similar way.

              Take a look in the jmx-console to get the object name.

              • 4. Re: Creation of topic @ runtime
                desuraghu

                But in 1.2 we have ServerPeerMBean and in 1.4 this one has been removed.

                So we don't have any option to get ServerPeer instance.

                • 5. Re: Creation of topic @ runtime
                  timfox

                   

                  "desuraghu" wrote:
                  But in 1.2 we have ServerPeerMBean and in 1.4 this one has been removed.

                  So we don't have any option to get ServerPeer instance.


                  That is not correct, ServerPeer is still there in 1.4, here it is in SVN:

                  http://anonsvn.jboss.org/repos/messaging/tags/JBossMessaging_1_4_4_GA/integration/EAP4/etc/server/default/deploy/messaging-service.xml

                  And here it is in 1.2:

                  http://anonsvn.jboss.org/repos/messaging/tags/JBossMessaging_1_2_0_GA/src/etc/server/default/deploy/messaging-service.xml

                  As I mentioned in my previous post you can see in jmx-console since the object name might have changed.

                  • 6. Re: Creation of topic @ runtime
                    desuraghu

                    I am referring to ServerPeerMBean. In 1.4 I can ServerPeer class.

                    From jmx-console, I can see and access the ServerPeer MBean.

                    But my requirement is, I need to create a topic at runtime.

                    To create a topic, i need ServerPeer instance.

                    I am trying to create a topic in my application at runtime.

                    Using jboss-MQ i am able to locate the DestinationManageMBean. In the similar way I am trying to locate ServerPeerMBean. But this interface is not present in 1.4.

                    • 7. Re: Creation of topic @ runtime
                      timfox

                       

                      "desuraghu" wrote:
                      I am referring to ServerPeerMBean. In 1.4 I can ServerPeer class.

                      From jmx-console, I can see and access the ServerPeer MBean.

                      But my requirement is, I need to create a topic at runtime.

                      To create a topic, i need ServerPeer instance.

                      I am trying to create a topic in my application at runtime.

                      Using jboss-MQ i am able to locate the DestinationManageMBean. In the similar way I am trying to locate ServerPeerMBean. But this interface is not present in 1.4.


                      You are mistaken, this interface *is* present in 1.4. I already posted the MBean descriptors in my previous post.

                      • 8. Re: Creation of topic @ runtime
                        timfox

                        The name of the MBean you are looking for is in 1.4 is ** jboss.messaging:service=ServerPeer **

                        Note that this name has *changed* from 1.2 so you will need to look in a different place in jmx-console

                        • 9. Re: Creation of topic @ runtime
                          timfox

                          And, by the way, this is a user question, *not* a design question and should have been posted in the user forum.