Class RangedAcknowledger

  • All Implemented Interfaces:
    Acknowledger

    public class RangedAcknowledger
    extends BulkSQSOperation
    implements Acknowledger
    Used to acknowledge group of messages. Acknowledging a consumed message acknowledges all messages that the session has consumed before and including that message.

    A big backlog of consumed messages can cause memory pressure, as well as an increase on the probability of duplicates.

    This class is not safe for concurrent use.

    • Method Detail

      • acknowledge

        public void acknowledge​(SQSMessage message)
                         throws javax.jms.JMSException
        Acknowledges all the consumed messages as well as the previously consumed messages on the session via calling deleteMessageBatch until all the messages are deleted.
        Specified by:
        acknowledge in interface Acknowledger
        Parameters:
        message - message to acknowledge.
        Throws:
        javax.jms.JMSException
      • notifyMessageReceived

        public void notifyMessageReceived​(SQSMessage message)
                                   throws javax.jms.JMSException
        Updates the internal queue for the consumed but not acknowledged messages if the message was not already on queue.
        Specified by:
        notifyMessageReceived in interface Acknowledger
        Parameters:
        message - notify acknowledger message is received
        Throws:
        javax.jms.JMSException
      • forgetUnAckMessages

        public void forgetUnAckMessages()
        Clears the list of not acknowledged messages.
        Specified by:
        forgetUnAckMessages in interface Acknowledger
      • action

        public void action​(String queueUrl,
                           List<String> receiptHandles)
                    throws javax.jms.JMSException
        Acknowledges up to 10 messages via calling deleteMessageBatch.
        Specified by:
        action in class BulkSQSOperation
        Parameters:
        queueUrl - queueUrl of the queue, which the receipt handles belong
        receiptHandles - the list of handles, which is be used to (negative)acknowledge the messages.
        Throws:
        javax.jms.JMSException