Interface QueuePollArgs
- All Superinterfaces:
SyncArgs<QueuePollArgs>
- All Known Implementing Classes:
QueuePollParams
Use the defaults() factory method to create a new instance with default settings.
Example usage:
QueuePollArgs args = QueuePollArgs.defaults()
.acknowledgeMode(AcknowledgeMode.MANUAL)
.timeout(Duration.ofSeconds(5))
.count(10);
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionSets the acknowledgment mode for message processing.count(int value) Sets the maximum number of messages to retrieve in a single poll operation.static QueuePollArgsdefaults()Creates a new instance of QueuePollArgs with default settings.headersCodec(Codec codec) Specifies the codec to use for decoding message headers.Sets the maximum time to wait for messages to become available.visibility(Duration value) Sets the visibility timeout for retrieved messages.Methods inherited from interface org.redisson.api.SyncArgs
syncFailureMode, syncMode, syncTimeout
-
Method Details
-
defaults
Creates a new instance of QueuePollArgs with default settings.- Returns:
- arguments object
-
acknowledgeMode
Sets the acknowledgment mode for message processing.The acknowledgment mode determines how messages are acknowledged after retrieval:
AcknowledgeMode.AUTO- Messages are automatically acknowledged after deliveryAcknowledgeMode.MANUAL- Messages must be explicitly acknowledged by the consumer
- Parameters:
mode- the acknowledgment mode to use- Returns:
- arguments object
- See Also:
-
headersCodec
Specifies the codec to use for decoding message headers.- Parameters:
codec- the codec to use for header deserialization- Returns:
- arguments object
-
timeout
Sets the maximum time to wait for messages to become available.If the queue is empty, the poll operation will block until either:
- At least one message becomes available
- The specified timeout duration elapses
If the timeout elapses without any messages becoming available, the poll operation will return empty collection of messages.
0means to wait indefinitely for a message.Default value is undefined.
- Parameters:
value- the maximum duration to wait for messages- Returns:
- arguments object
-
visibility
Sets the visibility timeout for retrieved messages.The visibility timeout specifies how long a message will be hidden from other consumers after it has been retrieved but before it has been acknowledged or negatively acknowledged. This prevents other consumers from processing the same message while it's being handled.
If a message is not acknowledged within this time period, it will become visible again in the queue and may be delivered to another consumer.
If not defined, the queue's visibility setting value is used. If queue's visibility setting is also not set, the default value is
30 seconds.- Parameters:
value- the duration for which retrieved messages should remain invisible to other consumers- Returns:
- arguments object
-
count
Sets the maximum number of messages to retrieve in a single poll operation.This parameter enables batch retrieval of messages, which can improve throughput when processing multiple messages at once. The actual number of messages returned may be less than the requested count if fewer messages are available.
- Parameters:
value- the maximum number of messages to retrieve- Returns:
- arguments object
-