4 Replies Latest reply on Mar 11, 2014 10:24 PM by Valy Sivec

    HornetMQ and dynamic topic

    Valy Sivec Newbie

      I'm currently using a messaging broker that allows me publish messages to dynamic topic via simple JMS API. I'm still new with HornetMQ, however, I noticed that I need to use some admin API or declare the topic in the config file before using it. This is a no starter for my application, so any clarification on this topic would be great.

       

      Any plans to support this feature? Apache's ActiveMQ supports this very well.

       

      Thanks,

      Vali

        • 1. Re: HornetMQ and dynamic topic
          Justin Bertram Master

          I'm not clear on what you mean by "dynamic topic."  Are you referring to what the JMS specification calls a "temporary topic"?  If so, you can use javax.jms.Session.createTemporaryTopic().

           

          If you're talking about something else, it's likely you can accomplish what you need via our management layer which is accessible via JMX, Core, or JMS.  See the documentation on this (including examples) for more details.

           

          If neither of those suits your need please clarify your use-case.

          • 2. Re: HornetMQ and dynamic topic
            Valy Sivec Newbie

            Hi Justin,

             

            I was looking for something like Topic topic = javax.jms.Sesesion.createTopic("TopicName") and the publish to this destination. I couldn't find any sample on how to create a topic on the fly... would appreciate any suggestions you might have.

             

            I looked over the management API and while I see that I can add various metrics/notifications for a queue/topic is still unclear to me how to create topics on the fly and publish to those topics.

             

            Thanks again,

            Vali Sivec

            • 3. Re: Re: HornetMQ and dynamic topic
              Justin Bertram Master

              I was looking for something like Topic topic = javax.jms.Sesesion.createTopic("TopicName") and the publish to this destination.

              While JMS does have javax.jms.Session.createTopic(String), this method only instantiates a reference to the topic in question and does not administratively create it.  I've seen this method most often used simply as a way to avoid a JNDI look-up.

               

              I couldn't find any sample on how to create a topic on the fly... would appreciate any suggestions you might have.

              We don't have any examples specifically demonstrating how to create a topic, but you can use either the "jmx" or "management" example as pattern and simply use the JMSServerControl interface to create the topic and bind it into JNDI where you need.  Once you do that then you can look it up from any client.

              • 4. Re: Re: HornetMQ and dynamic topic
                Valy Sivec Newbie

                Hi Justin, thanks for you feedback! Very helpful... i'll poke around more management API and give it a try.

                 

                Sivec