Interface RReliableQueueAsync<V>
- All Superinterfaces:
RExpirableAsync
,RObjectAsync
- All Known Subinterfaces:
RReliableQueue<V>
Unlike regular queues, this implementation provides features like:
- Message acknowledgment to confirm successful processing
- Message negative acknowledgment to redeliver a message or delete it if DLQ is not defined
- Redundancy and synchronous replication
- Deduplication by id or hash within a defined time interval
- Bulk operations
- Configurable queue size limit
- Configurable message size limit
- Configurable message expiration timeout
- Configurable message visibility timeout
- Configurable message priority
- Configurable message delay
- Configurable message delivery limit
- Automatic redelivery of unacknowledged messages
- Dead letter queue support for failed message handling
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionacknowledgeAsync
(QueueAckArgs args) Acknowledges the successful processing of a message.addAsync
(QueueAddArgs<V> params) Adds a message to the queue with the specified parameters.addListenerAsync
(QueueEventListener listener) Adds queue listeneraddManyAsync
(QueueAddArgs<V> params) Adds multiple messages to the queue in a single operation.Removes all messages from the queue.containsAsync
(String id) Checks if the queue contains a message with the specified ID.containsManyAsync
(String... ids) Checks if the queue contains messages with the specified IDs.Returns the number of delayed messages in the queue.Returns the number of unacknowledged messages in the queue.disableOperationAsync
(QueueOperation operation) Disables a queue operationenableOperationAsync
(QueueOperation operation) Enables a queue operationgetAllAsync
(String... ids) Returns messages by idsgetAllAsync
(Codec headersCodec, String... ids) Returns messages by ids applying specified codec to headersReturns message by idReturns message by id applying specified codec to headersReturns the names of source queues which uses this reliable queue as dead letter queue.Returns all messages in the queue, ready to be retrieved by the poll() command, without removing them.listAllAsync
(Codec headersCodec) Returns all messages in the queue, ready to be retrieved by the poll() command, using the specified codec for message header values.moveAsync
(QueueMoveArgs args) Moves messages from the queue to the end of the destination queue.Explicitly marks a message as failed or rejected.Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.pollAsync
(QueuePollArgs args) Retrieves and removes the head of this queue with the specified polling arguments.pollManyAsync
(QueuePollArgs pargs) Retrieves and removes multiple messages from the queue with the specified polling arguments.removeAsync
(QueueRemoveArgs args) Removes a specific message from the queue.Removes map entry listenerRemoves multiple messages from the queue in a single operation.setConfigAsync
(QueueConfig config) Sets the configuration for this reliable queue.setConfigIfAbsentAsync
(QueueConfig config) Attempts to set the configuration for this reliable queue.Returns the total number of messages in the queue, including messages in all states (ready, delayed, and unacknowledged).Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getAccessFrequencyAsync, getIdleTimeAsync, getInternalEncodingAsync, getReferenceCountAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
setConfigAsync
Sets the configuration for this reliable queue.- Parameters:
config
- the queue configuration to apply
-
setConfigIfAbsentAsync
Attempts to set the configuration for this reliable queue.This method only applies the configuration if no configuration has been set previously.
- Parameters:
config
- the queue configuration to apply- Returns:
true
if the configuration was successfully applied,false
if a configuration already exists
-
sizeAsync
Returns the total number of messages in the queue, including messages in all states (ready, delayed, and unacknowledged).- Returns:
- the total number of messages
-
countDelayedMessagesAsync
Returns the number of delayed messages in the queue.Delayed messages are those scheduled for future delivery and not yet available for consumption.
- Returns:
- the number of delayed messages
-
countUnacknowledgedMessagesAsync
Returns the number of unacknowledged messages in the queue.Unacknowledged messages are those that have been delivered to consumers but not yet acknowledged as successfully processed.
- Returns:
- the number of unacknowledged messages
-
clearAsync
Removes all messages from the queue.This operation clears messages in all states (ready, delayed, and unacknowledged).
- Returns:
true
if the queue existed and has been cleared, otherwise false
-
pollAsync
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.The retrieved message remains unacknowledged until explicitly acknowledged using the
acknowledgeAsync(QueueAckArgs)
ornegativeAcknowledgeAsync(QueueNegativeAckArgs)
method.- Returns:
- the message in the head of this queue, or
null
if this queue is empty
-
pollAsync
Retrieves and removes the head of this queue with the specified polling arguments.The retrieved message remains unacknowledged until explicitly acknowledged using the
acknowledgeAsync(QueueAckArgs)
ornegativeAcknowledgeAsync(QueueNegativeAckArgs)
method.- Parameters:
args
- polling arguments- Returns:
- the message in the head of this queue, or
null
if this queue is empty
-
pollManyAsync
Retrieves and removes multiple messages from the queue with the specified polling arguments.This batch operation is more efficient than polling messages individually.
The retrieved messages remain unacknowledged until explicitly acknowledged using the
acknowledgeAsync(QueueAckArgs)
ornegativeAcknowledgeAsync(QueueNegativeAckArgs)
method.- Parameters:
pargs
- polling arguments- Returns:
- a list of retrieved messages
-
acknowledgeAsync
Acknowledges the successful processing of a message.Once acknowledged, a message is permanently removed from the queue and will not be redelivered.
- Parameters:
args
- acknowledgment arguments
-
containsAsync
Checks if the queue contains a message with the specified ID.- Parameters:
id
- the message ID to check- Returns:
true
if a message with the specified ID exists in the queue,false
otherwise
-
containsManyAsync
Checks if the queue contains messages with the specified IDs.- Parameters:
ids
- the message IDs to check- Returns:
- the number of matching messages found in the queue
-
removeAsync
Removes a specific message from the queue.This operation can remove messages in any state (ready, delayed, or unacknowledged).
- Parameters:
args
- removal arguments- Returns:
true
if the message was successfully removed,false
if the message was not found
-
removeManyAsync
Removes multiple messages from the queue in a single operation.- Parameters:
args
- removal arguments- Returns:
- the number of messages successfully removed
-
moveAsync
Moves messages from the queue to the end of the destination queue.- Parameters:
args
- move arguments- Returns:
- the number of messages successfully moved
-
addAsync
Adds a message to the queue with the specified parameters.Returns
null
if the message hasn't been added for one of the following reasons:- Due to message deduplication by id or hash
- Due to configured queue size limit and queue is full
- Parameters:
params
- parameters for the message to be added- Returns:
- the added message with its assigned ID and metadata
-
addManyAsync
Adds multiple messages to the queue in a single operation.This batch operation is more efficient than adding messages individually.
Messages may not be added for one of the following reasons:
- Due to message deduplication by id or hash
- Due to configured queue size limit and queue is full
- Parameters:
params
- parameters for the messages to be added- Returns:
- a list of added messages with their assigned IDs and metadata
-
getDeadLetterQueueSourcesAsync
Returns the names of source queues which uses this reliable queue as dead letter queue.This only applies if this queue is configured as a dead letter queue in the source queue configurations.
- Returns:
- a set of source queue names
-
listAllAsync
Returns all messages in the queue, ready to be retrieved by the poll() command, without removing them.This operation is useful for inspection and debugging purposes.
- Returns:
- a list of all messages in the queue
-
listAllAsync
Returns all messages in the queue, ready to be retrieved by the poll() command, using the specified codec for message header values.- Parameters:
headersCodec
- the codec to use for deserializing message header values- Returns:
- a list of all messages in the queue
-
getAsync
Returns message by id- Parameters:
id
- message id- Returns:
- message
-
getAsync
Returns message by id applying specified codec to headers- Parameters:
headersCodec
- codec for headersid
- message id- Returns:
- message
-
getAllAsync
Returns messages by ids- Parameters:
ids
- message ids- Returns:
- message
-
getAllAsync
Returns messages by ids applying specified codec to headers- Parameters:
headersCodec
- codec for headersids
- message ids- Returns:
- message
-
negativeAcknowledgeAsync
Explicitly marks a message as failed or rejected.- Parameters:
args
- arguments specifying the message to negatively acknowledge
-
addListenerAsync
Adds queue listener- Parameters:
listener
- entry listener- Returns:
- listener id
- See Also:
-
removeListenerAsync
Removes map entry listener- Parameters:
id
- listener id
-
disableOperationAsync
Disables a queue operation- Parameters:
operation
- queue operation- Returns:
- void
-
enableOperationAsync
Enables a queue operation- Parameters:
operation
- queue operation- Returns:
- void
-