Interface Queue
- All Superinterfaces:
org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
- All Known Subinterfaces:
MonitorableQueue
- All Known Implementing Classes:
AbstractQueue,AbstractRedisQueue,InMemoryQueue,JedisClusterQueue,JedisQueue,RedisQueue
public interface Queue
extends org.springframework.context.SmartLifecycle
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfaceThe callback parameter type passed to [Queue.poll]. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum number of times an un-acknowledged message will be retried before failing permanently.Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Method Summary
Modifier and TypeMethodDescriptionDenotes a queue implementation capable of processing multiple messages per poll.default voidclear()Used for testing zombie executions.The expired time after which un-acknowledged messages will be retried.A handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.getName()default voidpoll(int maxMessages, Queue.QueueCallback callback) Polls the queue for ready messages, processing up-to [maxMessages].voidpoll(Queue.QueueCallback callback) Polls the queue for ready messages.default voidPush [message] for immediate delivery.voidpush(Message message, TemporalAmount delay) Push [message] for delivery after [delay].default voidretry()Check for any un-acknowledged messages that are overdue and move them back onto the queue.Methods inherited from interface org.springframework.context.Lifecycle
isRunning, start, stopMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Field Details
-
MAX_RETRIES
static final int MAX_RETRIESThe maximum number of times an un-acknowledged message will be retried before failing permanently.- See Also:
-
-
Method Details
-
getName
String getName() -
poll
Polls the queue for ready messages.Implementations may invoke [callback] any number of times. Some implementations may deliver a maximum of one message per call, others may deliver all ready messages.
If no messages exist on the queue or all messages have a remaining delay [callback] is not invoked.
Messages *must* be acknowledged by calling the function passed to [callback] or they will be retried after [ackTimeout]. Acknowledging via a nested callback allows the message to be processed asynchronously.
- Parameters:
callback- invoked with the next message from the queue if there is one and an _acknowledge_ function to call once processing is complete.
-
poll
Polls the queue for ready messages, processing up-to [maxMessages]. -
push
Push [message] for immediate delivery. -
push
Push [message] for delivery after [delay]. -
retry
default void retry()Check for any un-acknowledged messages that are overdue and move them back onto the queue.This method is not intended to be called by clients directly but typically scheduled in some way.
-
clear
default void clear()Used for testing zombie executions. Wipes all messages from the queue. -
getAckTimeout
TemporalAmount getAckTimeout()The expired time after which un-acknowledged messages will be retried. -
getDeadMessageHandlers
List<Queue.DeadMessageCallback> getDeadMessageHandlers()A handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times. -
canPollMany
Boolean canPollMany()Denotes a queue implementation capable of processing multiple messages per poll.
-