8 Replies Latest reply on Aug 20, 2010 12:06 PM by panda1

    can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?

    panda1

      Hi

       

      I am using 'activemq' and I want to move to 'hornetq' without changing the code (on the client side)

      The problam i am having :

      When I used ActiveMQ the clients has subscribing to "/topic/quotesTopic/XXX", where XXX is the symbol name

      on HornetQ, the clients must subscribe to "jms.Topic.quotesTopic/XXX".

      so, if we will be able to change on hornetQ the destinations, we will not need to touch clients at all.

       

      Is it even possible ?

       

      Thanks in advanced.

       

      Maor

        • 1. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
          timfox

          I don't understand the question.

           

          A code example would help.

          • 2. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
            panda1

            ok. let me explain it more...

             

            the client are using STOMP protocol.

            when the client connects (as for now to ActiveMQ), the subscribe to a topic.

            the destination the client use is : /topic/quotesTopic/XXXX, where XXX is a name (there are somthing like 140 names).

             

            Now, i want to move to hornetQ, but the clients cannot subscribe, unless i change on the clients the destination to "jms.topic.quotesTopic/XXXX".

            What I need is the clients to connect the same destination as they was connecting on ActiveMQ.

             

            In simple words, I need the HornetQ configure the destinations exactly like ActiveMQ, so there will be no change on clients.

            • 3. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
              jmesnil

              I understand your problem. But Stomp destinations are specific to the brokers implementation.

              We use our own semantic which differs from ActiveMQ.

               

              I don't see another workaround than changing the names on the clients at the moment.

              If this is a major obstacle, you could provide a patch which transform "/topic/quotesTopic/XXXX" into ""jms.topic.quotesTopic/XXXX" in HornetQ's StompSession...

              • 4. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
                panda1

                that patch will work great to me.

                How do i do it?

                 

                It is very important to me, and i think it was a mistake to choose ActiveMQ.

                I cannot change clients, since they are iPhone clients, and apple does not make life easy when you change code

                 

                So, i must find a solution to use hornetQ with iphones that "think" the are using ActiveMQ, but actually using HornetQ.

                 

                Your help will be very appriciated.

                • 5. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
                  jmesnil

                  maor Lo wrote:

                   

                  that patch will work great to me.

                  How do i do it?

                  It should not be complex.

                   

                  Have a look at HornetQ's StompProtocolManger. In the methods onSend, onSubscribe and on Unsubscribe, we extract the destination from the frame headers at the beginning of each method.

                  You could add code to check if the destination starts with "/topic/" and if that's the case, replace it with "jms.topic.". The rest of the code would remain unchanged.

                   

                  maor Lo wrote:

                   

                  I cannot change clients, since they are iPhone clients, and apple does not make life easy when you change code

                   

                  I know: I wrote a game for the App Store and it is a PITA to release new versions

                   

                  I'd be interested to know more about the use of HornetQ with iPhone clients if it is possible. It'd make for a great story about HornetQ deployment.

                  • 6. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
                    panda1

                    You are the greatest!!!!

                     

                    I did what you have suggested and now my clients can connect and subscribe to topics.

                     

                    now, with your permission i have 2 more problems:

                    1. when 2 clients connect and subscribe, I get the following error :

                    "there already a subscription for quotesTopic/XXXX" ......."

                     

                    Doest the server create a subscription automaticly when a client subscribe?

                    I did the following in the code, when subscription occurs

                     

                    if (id != null)
                          {
                             subscriptionID = id;
                          }
                          else
                          {
                             if (destination == null)
                             {
                                throw new StompException("Client must set destination or id header to a SUBSCRIBE command");
                             }
                             subscriptionID = "subscription/" + destination + "/" + consumerID;
                          }

                     

                    so now i don't get an exception when 2 clients connect and subscribe.

                    but, how do I get the consumerID for the unsubscribe method?

                     

                    2. I need to configure the server for handling a lot of stock quotes recieving and sended to a topic.

                    can you provide help with the configuration?

                     

                    again, i really do appriciate your help. the issue with the topics help me a lot, and i wouldn't manage to solve it without you.

                    • 7. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
                      jmesnil

                      maor Lo wrote:

                       

                      now, with your permission i have 2 more problems:

                      1. when 2 clients connect and subscribe, I get the following error :

                      "there already a subscription for quotesTopic/XXXX" ......."

                       

                      Doest the server create a subscription automaticly when a client subscribe?

                      Mmmh, that's a shortcoming of the code, you can not have more than one subscriber on a destination coming from a single connection (unless you assigned them ids).

                       

                      When you says 2 clients, do you mean 2 separate iPhones? They should have 2 different session on the server (since they come from different connections) and it should not be a problem. Otherwise, there is a bug in the code.

                      • 8. Re: can we change the - subscribe to "jms.Topic.quotesTopic/XXX" ?
                        panda1

                        OK. I will check it.

                        what about the configuration for the server?

                        can you help regarding that?

                         

                        by the way, I will glad to provide the iphone app as an example for using HorentQ on non-standart clients, after we will finish all the issues.