Skip to content

Queue

In-memory and Redis message queue operations.

3 modules

ModuleDescription
Dequeue ItemRemove and return an item from a queue
Enqueue ItemAdd an item to an in-memory or Redis queue
Queue SizeGet the current size of a queue

Modules

Dequeue Item

queue.dequeue

Remove and return an item from a queue

Parameters:

NameTypeRequiredDefaultDescription
queue_namestringYes-Name of the queue to dequeue from
backendstringNomemoryQueue backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL
timeoutnumberNo0Timeout in seconds (0 = non-blocking)

Output:

FieldTypeDescription
dataanyThe dequeued item (null if queue is empty)
queue_namestringName of the queue
remainingnumberRemaining items in the queue
emptybooleanWhether the queue was empty

Enqueue Item

queue.enqueue

Add an item to an in-memory or Redis queue

Parameters:

NameTypeRequiredDefaultDescription
queue_namestringYes-Name of the queue to add the item to
datastringYes-Data to enqueue (any JSON-serializable value)
backendstringNomemoryQueue backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
queue_namestringName of the queue
positionnumberPosition of the item in the queue
queue_sizenumberCurrent size of the queue after enqueue

Queue Size

queue.size

Get the current size of a queue

Parameters:

NameTypeRequiredDefaultDescription
queue_namestringYes-Name of the queue to check
backendstringNomemoryQueue backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
queue_namestringName of the queue
sizenumberCurrent number of items in the queue

Released under the Apache 2.0 License.