Skip to main content

Create Queue

Creates a new in-memory FIFO (First-In-First-Out) queue with optional initial elements. The queue operates entirely in memory for fast, temporary data processing within an automation session.

Common Properties​

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing the node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Output​

  • Queue ID - Unique identifier (UUID) for the created queue. Use this ID in all subsequent queue operations (Enqueue, Dequeue, Clear, Delete).

Options​

  • Elements - An optional array of initial elements to add to the queue at creation time. Any data type can be used (strings, numbers, objects, arrays).

How It Works​

The Create Queue node initializes a new in-memory FIFO queue and returns a unique identifier. When executed, the node:

  1. Generates a unique UUID for the queue
  2. Creates a new thread-safe FIFO queue in memory
  3. Adds any initial elements provided (in order)
  4. Returns the queue ID for use in subsequent operations

Examples​

Example 1: Create Empty Queue​

Options:

  • Elements: (not set)

Result:

  • Queue ID: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  • Empty queue ready for use

Example 2: Create Queue with Initial Data​

Options:

  • Elements:
["task1", "task2", "task3"]

Result:

  • Queue ID: "f9e8d7c6-b5a4-3210-fedc-ba0987654321"
  • Queue contains three items ready to be dequeued

Example 3: Create Queue with Objects​

Options:

  • Elements:
[
{"id": 1, "url": "https://example.com/page1", "priority": "high"},
{"id": 2, "url": "https://example.com/page2", "priority": "normal"},
{"id": 3, "url": "https://example.com/page3", "priority": "low"}
]

Result: Queue initialized with three task objects for processing.

Example 4: Producer-Consumer Pattern​

Create a queue and pass the Queue ID to both producer and consumer flows:

Flow 1 (Producer):

  1. Create Queue → Store Queue ID in variable
  2. Loop through data source
  3. Enqueue each item using Queue ID

Flow 2 (Consumer):

  1. Receive Queue ID from producer
  2. Loop to process items
  3. Dequeue using Queue ID
  4. Process each item
  5. Delete Queue when done

Use Cases​

  • Batch processing - Create a queue with items to process sequentially
  • Task distribution - Initialize a queue that multiple parallel flows can consume from
  • Data buffering - Collect items before processing them in batches
  • Workflow coordination - Share data between different parts of an automation
  • Job queue - Create a temporary work queue for parallel processing

Error Handling​

The node will return errors in the following cases:

  • ErrInvalidArg - Invalid elements array format
  • ErrInternal - Failed to set output or create queue

Tips and Best Practices​

  • Store the Queue ID - Save the returned Queue ID in a variable for use in other nodes
  • Initialize with data - If you have a known set of items, include them at creation to avoid multiple Enqueue operations
  • One queue per workflow - Create separate queues for different types of tasks
  • Clean up - Always delete the queue when finished to free memory
  • Share across flows - Pass the Queue ID to other flows or subflows to enable concurrent processing
  • Document queue purpose - Use meaningful variable names for Queue IDs (e.g., urlQueueId, taskQueueId)

Memory Considerations​

  • Queues exist only in the automation's memory
  • Queues are lost if the automation stops or crashes
  • For persistent queues, use the Queue package instead
  • Large queues can consume significant memory - monitor usage for big datasets
  • Delete unused queues to prevent memory leaks

Thread Safety​

  • Memory queues are thread-safe and can be accessed concurrently
  • Multiple flows can enqueue and dequeue simultaneously
  • FIFO ordering is guaranteed even with concurrent access
  • No locking required when using queue operations

Comparison with Queue Package​

Memory Queue:

  • In-memory only (fast)
  • No persistence
  • No database required
  • Simple create/delete lifecycle
  • Best for temporary processing

Queue Package:

  • Database-backed (persistent)
  • Survives restarts
  • Supports priority and retry logic
  • More complex setup
  • Best for production workflows