5 Replies Latest reply on Feb 25, 2011 8:20 PM by Reid Morrison

    Stomp - Migrating from ActiveMQ

    peteredhead Newbie

      Hi,

       

      My company has an application where clients subscribe to Stomp topics in the format /topic/aaa/bbb/ccc/text

       

      We currently use ActiveMQ, but would like to move to HornetQ as it offers some additional features that would really benefit us.

       

      However, I am unable to find a way of replicating the topic structure with HornetQ.

      Using the examples and documentation as a base, I have tried to replicate this but always the receive the error that the queue does not exist.

      I have tried moving the configuration to the core (rather than jms) but still have the same problem.

       

      Could anyone suggest a way to proceed? Changing the code in our application is sadly not a feasible solution.

       

      Many thanks,

       

      Pete Redhead

        • 1. Stomp - Migrating from ActiveMQ
          Clebert Suconic Master

          Take a look at the docs. The topic has a special name for the Address name.

          • 2. Re: Stomp - Migrating from ActiveMQ
            peteredhead Newbie

            Thanks for the reply.

             

            I used the docs initally to make the changes to the hornet-configuration.xml file.

             

            First I added the Stomp acceptor:

            <acceptor name="stomp-acceptor">
            <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
            <param key="protocol" value="stomp" />
            <param key="use-nio" value="true" />
            <param key="host" value="0.0.0.0" />
            <param key="port" value="61613" />
            </acceptor>
            

             

            Initially I tried adding the topics to the hornet-jms file, but always received a topic does not exist error.

            Next I tried moving the topics to the hornet-configuration.xml file, but that caused an error on startup. It appears the <topics> tag is not recognised.

             

            <topics>
              <topic name="test">
                <address>/topic/test</address>
              </topic>
            </topics>
            

             

            Next I tried putting the topic in a <queues> tag, which stopped the error on startup, but I still could not subscribe to the topic.

             

            <queues>
              <topic name="test">
                <address>/topic/test</address>
              </topic>
            </queues>
            

             

            Whatever I try, I always get the error:

            received an error HornetQException[errorCode=100 message=Queue /topic/test does not exist]

             

            Is there anywhere else in the docs (other than

            http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/interoperability.html ) that I can get more information from?

             

            Thanks,

             

            Pete

            • 3. Stomp - Migrating from ActiveMQ
              Clebert Suconic Master

              There are the examples on stomp also.. did you look at them?

              • 4. Stomp - Migrating from ActiveMQ
                peteredhead Newbie

                Clebert Suconic wrote:

                 

                There are the examples on stomp also.. did you look at them?

                Yes, but I was unable to set up the topics and subscribe to them, using the topic structure I require.

                • 5. Re: Stomp - Migrating from ActiveMQ
                  Reid Morrison Newbie

                  Hi Pete,

                   

                  HornetQ has moved on from the previous concept of Topics and Subscriptions. It uses a newer model that started (as far as I know) with AMQP where you have Addresses and Queues. Rather than subscribing to a topic, HornetQ allows a producer to write to an Address. Consumers read from Queues.

                   

                  Messages are routed to Queues through Addresses. To select which messages you want to receive (subscribe), one uses filters on the address.

                   

                  This is a substantial shift, but introduces substantial power. For example, we are no longer limited to a simple topic, but can now filter messages on any property on the message.

                   

                  I work primarily on JRuby (Ruby on the Java VM) and used to use the JMS API for all messaging. I have since moved to the HornetQ Core API due to the above more powerful features. https://github.com/ClarityServices/jruby-hornetq

                   

                  I looked at the source code for the Stomp protocol implementation and it uses the Core API, so it looks like it follows the newer Address, Queue, Filter approach as opposed to the JMS Pub Sub mechanism. I am going to spend more time reading the HornetQ Stomp source code, so will update this post should I find anything different.

                   

                  ActiveMQ only exposes a JMS API, with HornetQ's use of the Core API for Stomp, none of the JMS configurations apply to the Stomp interface. Look rather at configuring Addresses, Queues and Filters for the Core API and therefore Stomp.

                   

                  We have started using the Stomp protocol to integrate with Go Language clients. HornetQ is fast and reliable, so very well worth the move.

                   

                  Enjoy!

                  Reid

                  1 of 1 people found this helpful