Queue
Version: 1.2.9 · ID: zoan-packages-queue · Author: Zoan Software
The Queue package lets bots work with Zoan Cloud work queues: lists of pending work processed one by one, with atomic locking, retries and priorities. It’s the RPA pattern for processing large batches robustly and in parallel.
The two halves: producer and consumer
Section titled “The two halves: producer and consumer”- The producer (dispatcher) fills the queue with Add Queue Item.
- The consumer (performer) empties the queue: it takes items with Get Queue Item, processes them and reports the result with Set Transaction Status. Or all of it in a single activity with Process Queue.
Activities
Section titled “Activities”| Activity | Type | Output | What it does |
|---|---|---|---|
| Add Queue Item | queue-add-item | ZoanQueueItem | Enqueues a new item with its payload; optionally with a human task that must be decided before processing it |
| Add Transaction Item | queue-add-transaction-item | ZoanQueueItem | Creates an item and returns it already in_progress and locked (create + process in the same run) |
| Get Queue Item | queue-get-item | ZoanQueueItem | Takes (and locks) the next item; null if the queue is empty |
| Process Queue | queue-process | — | Empties the whole queue: takes each item, runs your logic and reports the result (the performer in a single activity) |
| Set Transaction Status | queue-set-transaction-status | — | Marks an item as successful or failed |
| Postpone Transaction | queue-postpone-transaction | — | Returns the item to the queue and defers it (without counting the attempt) |
The item: ZoanQueueItem
Section titled “The item: ZoanQueueItem”Add Queue Item, Add Transaction Item and Get Queue Item return a ZoanQueueItem, and Process Queue puts it in the item variable. Its fields, accessible from expressions:
| Field | Type | What for |
|---|---|---|
item.Id | string | Unique identifier (UUID): you need it to report the status. |
item.QueueId | string | Queue id. |
item.Reference | string | The reference the producer gave it (null if none). |
item.Status | string | Current status: new, in_progress, successful, failed, business_exception, abandoned, retried, review or waiting_decision (waiting for its human task’s decision). |
item.SpecificContent["field"] | Dictionary | The payload: the data the bot must process. |
item.Priority | string | high, normal or low. |
item.Attempts | int | How many attempts have been made on this item (including the current one). |
item.Output | Dictionary | The stored result (if it finished successfully); null if none. |
item.Exception | Dictionary | The error detail (if it failed); null if none. |
item.Progress | string | Last progress message reported. |
item.DeferUntil | string | Date (ISO 8601, UTC) before which it isn’t handed out; null if not deferred. |
item.ProcessingStartedAt / item.ProcessedAt / item.CreatedAt | string | When processing started, when it finished and when it was enqueued (ISO 8601, UTC). |
item.HumanTaskId | string | Id of the linked human task, if any. |
item.HasDecision | bool | true if the item had a linked human task that has been decided, expired or cancelled. |
item.Decision.Value | string | The chosen option ("Aprobar", "Rechazar"…); empty if it expired or was cancelled. Also Decision.Status (completed, expired, cancelled), Decision.Comment, Decision.Fields["field"], Decision.DecidedBy, Decision.DecidedAt and Decision.TaskId. |
For example, if you enqueued the payload with an invoiceId field, inside the performer you read it like this: item.SpecificContent["invoiceId"].
The producer / consumer pattern
Section titled “The producer / consumer pattern”Normally there are two playbooks (published as two processes).
1. Dispatcher — fills the queue
Section titled “1. Dispatcher — fills the queue”It goes through the data source and enqueues one item per unit of work. It’s usually launched with a scheduled trigger.
Read Range file = "invoices.xlsx" → output: invoices
For Each item in = invoices.Rows └─ body: Add Queue Item queueName = "invoices-to-validate" reference = item["number"] specificContent = { "invoiceId": item["number"], "amount": = item["amount"] }The reference (optional) makes enqueuing idempotent: if you enqueue the same reference again, Zoan Cloud returns the existing item instead of creating a duplicate. Useful if the dispatcher runs twice.
2. Performer — empties the queue
Section titled “2. Performer — empties the queue”In a loop, it takes items until the queue is empty, processes each one and reports the result inside a Try / Catch.
While condition = true └─ body: Get Queue Item queueName = "invoices-to-validate" → output: item
If condition = item == null └─ then: Break (the queue is empty → leave the loop)
Try └─ body: (… process = item.SpecificContent["invoiceId"] …) Set Transaction Status item = item status = successful output = { "validated": true } └─ catch (err): Set Transaction Status item = item status = failed exception = { "message": err.Message }Next steps
Section titled “Next steps”- Work queues (Zoan Cloud) — create and manage queues, statuses and retries.
- Human decisions in batches — items that wait for a person’s decision.
- Try / Catch — to report failures properly.
- Core —
While,If,For Each,Breakfor the performer loop.