3 Replies Latest reply on Apr 21, 2004 9:56 AM by adrian.brock

    Using CLIENT_ACKNOWLEDGE does not seem to work

    mayobria

      I tried reading the documentation and this forum but I could not find my answer.

      The question is: Does CLIENT_ACKNOWLEDGE work when setting up a client to read messages from a queue? From my testing, it does not work, but I could be doing something wrong.

      Snipped of my code:
      ...

      queueSession = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);

      ...
      queueReceiver.setMessageListener(textListener);

      ...
      { textListener implements MessageListener with an onMessage method.
      In the onMessage method is where I message.acknowledge or not }

        • 1. Re: Using CLIENT_ACKNOWLEDGE does not seem to work
          • 2. Re: Using CLIENT_ACKNOWLEDGE does not seem to work
            mayobria

            Adrian,
            Thank you for the example, I have it working now.

            Let me ask a final question regarding JMS and CLIENT_ACKNOWLEDGE rooted in the machanics of JMS rather than specifically with JBoss's implementation.

            Let us say we have two MDB listening to the same queue. The message gets delivered to the first MDB, but this MDB does not acknowledge the message. Does the second MDB need to call the session.recover method in order to be able to pick-up this unacknowledged message?
            Also, from a timing perspective, what triggers a message to be determined re-deliverable? For example, I may want to have a message delivered to a MDB, perform some operations that may take a few seconds or a minute, and then depending on the success of the operations acknowledge the message or leave it unacknowledged for a different MDB to fetch or for this same MDB to fetch at a near future time.

            Regards,
            -Brian

            • 3. Re: Using CLIENT_ACKNOWLEDGE does not seem to work

              Each MDB gets their own session (which you don't have access to anyway).

              If you don't acknowledge a message, it will be marked redelivered the next
              time it is delivered. This could also happen due to network/client/server failure
              or transaction rollback, not just client acknowledge.

              Regards,
              Adrian