3 Replies Latest reply on Dec 20, 2010 7:27 PM by Clebert Suconic

    Transactional message receives?

    David Escandell Newbie

      I'm not sure what to call what I am trying to do.

       

      I have a queue which contains messages.  I have multiple consumers of those messages.  When one takes a message from a queue, I dont want another consumer to be able to operate on that message.  When the consumer that has consumed a message finishes processing a message, I want it to be removed from the queue - not before.  If the consumer goes down in the middle of processing a message, I want the message to be available for other consumers to process.

       

      I have been working through the examples to try to implement this.  I have used transactional examples, receiving a message and committing the message when successful processing has occurred - or rolling it back when an error occurs.  I have also used different ACKNOWLEDGE settings.

       

      In all cases, so far, the message seems to stay on the queue until some timeout period elapses.  The consumer receives the message, processes it, commits it (or acknowledges it), then goes to process another message from the queue and gets the same one again.

       

      How can I accomplish what I am trying to do?  Are there some keywords I can search for to find my answer?

       

      Thanks.

        • 1. Re: Transactional message receives?
          Clebert Suconic Master

          The messages should be back to the queue as soon as you closed the connection/consumer.

           

           

          Unless you're not closing the connection, leaving to be checked by the Time-to-live.

           

           

          Make sure you close your connections properly when you finish the consumer. you should tweak TTL If you have no control over the kill on the client to make sure the dead connection is perceived earlier.

          • 2. Re: Transactional message receives?
            David Escandell Newbie

            That's the way I understood it to work - however the commits dont seem to be working.  I would expect that when a message is committed ( a receive ) it would be removed from the queue completely.  My next request for a message from the queue should give me a different message - or none at all if the queue is now empty.  Is commit the wrong thing to be using?  is there a type of acknowledgement I should use?

            • 3. Re: Transactional message receives?
              Clebert Suconic Master

              You are certainly doing something wrong. This is such a common usecase.. .we would have lots of complaints about it if what say was a bug.

               

              Are you using core-api or JMS api?

              What version are you using?

              Any MDBs?

              If JMS: Queue or Topic?

              How you ACK the messages?

              How you created the session (if JMS).