1 Reply Latest reply on Aug 22, 2011 11:17 AM by Andy Taylor

    Multi-threaded durable subscriptions?

    Billy Sjöberg Newbie

      Hi guys,

       

      We're implementing an integration layer that relies heavily on durable subscriptions for routing and I'd like to get some pointers regarding the performance hits when using Durable subscribers.

      The reason I'm asking is because I've seen a lot of discussions on the net regarding the anti-pattern of using durable subscriptions since you're basically ending up with singletons as each subscription must be unique regarding the clientID and the subscriptionID.

       

      However, since HornetQ under the cover registers each durable subscription as it's own internal queue, wouldn't it be safe to have multiple competing consumer threads receiving messages from this queue? Is the statement that the J2EE spec of durable subscriptions leaves you with a single-threaded application just FUD?

       

      I'm using HornetQ 2.2.5 in conjunction with JBoss ESB 4.9 and have one topic (T) with two durable subscriptions (A.A and B.B for example). Each durable subscription is the input to separate ESB services/flows.

       

      Looking at my JMX stats I can see that the org.hornetq.Queue.core.jms.topic.T has three MBeans registered.

       

      - jms.topic.T maps to the actual topic and has a consumercount of 0

      - A.A maps to the durable subscription A.A, has a consumercount of 15

      - B.B maps to the durable subscription B.B, has a consumercount of 15

       

      1) Does this mean that the ESB has created two sessions (with the subscriptionID & clientID) but 15 consumers for each session?

      2) Though my subscriptions seems to be multi-threaded, is there anything else I should be aware of regarding the threading model, or can I continue to naively regard my solution as a multi-threaded setup?

       

      I know that this topic (pun not intented) has been debated for ages, but I'd like some clear design hints on how to use them with Hornet.

       

      Thanks!

        • 1. Re: Multi-threaded durable subscriptions?
          Andy Taylor Master

          1) Does this mean that the ESB has created two sessions (with the subscriptionID & clientID) but 15 consumers for each session?

          I would say yes however the ESB guys would know better, if they do it the same way as MDB's then it will be 15 sessions with one consumer per session.

           

          2) Though my subscriptions seems to be multi-threaded, is there anything else I should be aware of regarding the threading model, or can I continue to naively regard my solution as a multi-threaded setup?

          If all the consumers are in the same session then your application wont be multi threaded, howevere like i say, im not an ESB expert and im not sure how this is handled.

           

          Maybe you could give me more info