Class RangedAcknowledger
- java.lang.Object
-
- com.amazon.sqs.javamessaging.acknowledge.BulkSQSOperation
-
- com.amazon.sqs.javamessaging.acknowledge.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.
-
-
Constructor Summary
Constructors Constructor Description RangedAcknowledger(AmazonSQSMessagingClientWrapper amazonSQSClient, SQSSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge(SQSMessage message)
Acknowledges all the consumed messages as well as the previously consumed messages on the session via callingdeleteMessageBatch
until all the messages are deleted.void
action(String queueUrl, List<String> receiptHandles)
Acknowledges up to 10 messages via callingdeleteMessageBatch
.void
forgetUnAckMessages()
Clears the list of not acknowledged messages.List<SQSMessageIdentifier>
getUnAckMessages()
Returns the list of all consumed but not acknowledged messages.void
notifyMessageReceived(SQSMessage message)
Updates the internal queue for the consumed but not acknowledged messages if the message was not already on queue.-
Methods inherited from class com.amazon.sqs.javamessaging.acknowledge.BulkSQSOperation
bulkAction
-
-
-
-
Constructor Detail
-
RangedAcknowledger
public RangedAcknowledger(AmazonSQSMessagingClientWrapper amazonSQSClient, SQSSession session)
-
-
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 callingdeleteMessageBatch
until all the messages are deleted.- Specified by:
acknowledge
in interfaceAcknowledger
- 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 interfaceAcknowledger
- Parameters:
message
- notify acknowledger message is received- Throws:
javax.jms.JMSException
-
getUnAckMessages
public List<SQSMessageIdentifier> getUnAckMessages()
Returns the list of all consumed but not acknowledged messages.- Specified by:
getUnAckMessages
in interfaceAcknowledger
-
forgetUnAckMessages
public void forgetUnAckMessages()
Clears the list of not acknowledged messages.- Specified by:
forgetUnAckMessages
in interfaceAcknowledger
-
action
public void action(String queueUrl, List<String> receiptHandles) throws javax.jms.JMSException
Acknowledges up to 10 messages via callingdeleteMessageBatch
.- Specified by:
action
in classBulkSQSOperation
- Parameters:
queueUrl
- queueUrl of the queue, which the receipt handles belongreceiptHandles
- the list of handles, which is be used to (negative)acknowledge the messages.- Throws:
javax.jms.JMSException
-
-