3 Replies Latest reply on May 3, 2002 8:04 PM by mary

    Dynamically creating/deleting topics

    mary Newbie

      Hi,
      I'm using the JMS Server MBean to create topics dynamically (via createTopic()). Everything is working okay, but I'd like to verify that this is a correct use of the function. (In the source it says it should only be used to bi-pass JNDI lookup, but another forum discussions said this was okay.)

      As well, once I've created dynamic topics, how can I programmatically delete them? There doesn't seem to be any function to close a topic on the JMS server MBean.

      The reason I'm not using temporary topics is that I need to allow access to multiple subscribers on the topic, not just the creator. As well, I need to keep the topic connection open for an indefinate amount of time (I'm not sure that this is possible with temp topics ?)

      Hints/Comments very appreciated!

      Thanks,
      Mary

        • 1. Re: Dynamically creating/deleting topics
          mary Newbie

          As soon as I posted this I found the solution...
          See the JMX web interface for the jms server (port 8082) for details. thanks

          • 2. Re: Dynamically creating/deleting topics
            mary Newbie

            Well, unfortunetly the solution I found doesn't allow me to recreate a Topic of the same name after it's been destroyed.

            I have rc1 of JBoss 3.0.0 testing both through the JMX web interface, and programmatically, I get this exception when I call createTopic() after having successfully destroyed it via destroyTopic():

            javax.jms.JMSException: This destination has allready been added to the server!
            at org.jboss.mq.server.JMSServer.addDestination
            (JMSServer.java:830)
            at org.jboss.mq.server.TopicManager.startService
            (TopicManager.java:56)
            at org.jboss.system.ServiceMBeanSupport.start
            (ServiceMBeanSupport.java:162)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke
            (NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke
            (DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
            (ReflectedMBeanDispatcher.java:284)
            ...

            If I do a JNDI lookup of the topic, it doesn't exist, and the server log file says it was successfully destroyed. Is this a bug or am I just missing a step?

            Thanks,
            Mary

            • 3. Re: Dynamically creating/deleting topics
              mary Newbie

              This discussion moved to the dev forum:
              Re: [JBoss-dev] dynamically adding/removing queues/topics

              And, the bug has been fixed in latest code drop. Thanks!