8 Replies Latest reply on Feb 22, 2007 6:03 PM by ovidiu.feodorov

    Configuring Destinations

    apk2072

      In my application I am adding several destinations (Queues), one way of binding those destinations is create a myApp-service.xml and drop in the $JBOSS/server/default/deploy folder.

      Instead of above approach, is there any other way I can bind the destinations? All my destination configuration is maintained in one of our database tables, I am looking something that during the server startup this configuration information is retrieved from the database table and do the binding instead of reading from the ../deploy/myApp-service.xml.

      Thanks in advance,

      APK.

        • 1. Re: Configuring Destinations
          timfox

          You can create destinations programmatically using the ServerPeer MBean interface.

          So I guess you could write a program that read the data from the database and called the mbean server to create the destinations.

          • 2. Re: Configuring Destinations
            clebert.suconic

            *I guess * it would be nice if the next JMS spec version could add an Admin API.

            • 3. Re: Configuring Destinations
              timfox

              Next JMS spec? :D

              Don't hold your breath, JMS has been frozen for years. (since 2002 to be precise).

              • 4. Re: Configuring Destinations
                timfox

                IIRC JMS is basically a LCD (lowest common denominator spec) that was basically written to unify the two forms of messaging prevalent at the time by the two main messaging providers- fast non persistent publish subscribe - as used by Tibco and point to point queues as used by IBM MQ series. I believe the spec was basically written by IBM.

                I think you'll have an extraordinarily hard time getting agreement on another JMS spec.

                • 5. Re: Configuring Destinations
                  apk2072

                   

                  "timfox" wrote:
                  You can create destinations programmatically using the ServerPeer MBean interface.

                  So I guess you could write a program that read the data from the database and called the mbean server to create the destinations.


                  Tim, Thanks for the feedback, do you have any such samples?

                  -APK

                  • 6. Re: Configuring Destinations
                    timfox

                    There should be plenty of examples of how to call an MBean operation on the jboss wiki.

                    • 7. Re: Configuring Destinations
                      apk2072

                      I found some sample in examples folder. Here is the piece of java code, which works good.

                      public static void deployQueue(String jndiName) throws Exception
                      {
                      System.out.println("Deploying the queue - " + jndiName);

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

                      System.out.println("Queue " + jndiName + " deployed");
                      }

                      • 8. Re: Configuring Destinations
                        ovidiu.feodorov

                        Yep, totally forgot about that ...

                        It's worth running the examples, yes :)