Class RangedAcknowledger
java.lang.Object
com.amazon.sqs.javamessaging.acknowledge.BulkSQSOperation
com.amazon.sqs.javamessaging.acknowledge.RangedAcknowledger
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionRangedAcknowledger
(AmazonSQSMessagingClientWrapper amazonSQSClient, SQSSession session) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Acknowledges up to 10 messages via callingdeleteMessageBatch
.void
Clears the list of not acknowledged messages.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 Details
-
RangedAcknowledger
-
-
Method Details
-
acknowledge
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:
jakarta.jms.JMSException
-
notifyMessageReceived
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:
jakarta.jms.JMSException
-
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
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:
jakarta.jms.JMSException
-