5 Replies Latest reply on Jun 2, 2011 9:56 PM by jscheid

    STOMP and Individual Ack?

    jscheid Newbie

      Hi,

       

      I'm in the process of porting an application from JBM+StompConnect to HornetQ with native STOMP protocol handler.

       

      One issue I've just run into is that StompSession calls ServerSessionImpl.acknowledge rather than ServerSessionImpl.individualAcknowledge, forcing  acknowledgment of messages in the order in which they were received.  This breaks my application, which processes and acknowledges messages out-of-order using separate worker threads. StompConnect doesn't have the same limitation, and the STOMP protocol description also doesn't mention it.  Could this be changed to use individualAcknowledge by default, or could this be made configurable?

       

      Thanks,

       

      Julian

        • 1. Re: STOMP and Individual Ack?
          Tim Fox Master

          HornetQ is just following the STOMP 1.0 spec http://stomp.codehaus.org/Protocol :

           

          "When a client has issued a SUBSCRIBE frame with the ack header set to client any messages received from that destination will not be considered to have been consumed (by the server) until the message has been acknowledged via an ACK."

           

          BTW StompConnect won't do anything different since it just uses the JMS API, and there is no way using JMS to acknowledge an individual message out of order.

          • 2. Re: STOMP and Individual Ack?
            jscheid Newbie

            Thanks for your reply.

             

            You are right that HornetQ is under no obligation to support out-of-order acknowledgements, I was mistaken. I missed the bit where vanilla JMS doesn't support out-of-order acks.  I'm not sure I agree that the STOMP spec is clear in this regard -- it doesn't clarify what "any messages" are in the context of "the message" -- but you are probably right that the intention was to match JMS behaviour.

             

            That said, if I'm not missing anything HornetQ could easily support out-of-order STOMP acks, and my application -- and probably others -- would benefit from it. Would you consider adding this as a feature that can be enabled in the configuration?  I'd be happy to provide a patch to this end.

            • 3. Re: STOMP and Individual Ack?
              jscheid Newbie

              Even better than a configuration option might be to introduce a third ack mode, something pseudo-namespaced like "hornetq:individual" maybe?  The STOMP spec does mention ack modes beyond "auto" and "client" in passing... ( http://stomp.codehaus.org/Ack+Modes )

              • 4. Re: STOMP and Individual Ack?
                jscheid Newbie

                Even betterer: STOMP 1.1 provides a new ack type, client-individual!

                 

                It would be fantastic to add support for this prior to adding full STOMP 1.1 support as per HORNET-553. I'll send over a patch shortly.

                • 5. Re: STOMP and Individual Ack?
                  jscheid Newbie

                  I took the liberty of creating issue HORNETQ-713 with a patch for this.