Skip to content

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.

ActivityTypeOutputWhat it does
Add Queue Itemqueue-add-itemZoanQueueItemEnqueues a new item with its payload; optionally with a human task that must be decided before processing it
Add Transaction Itemqueue-add-transaction-itemZoanQueueItemCreates an item and returns it already in_progress and locked (create + process in the same run)
Get Queue Itemqueue-get-itemZoanQueueItemTakes (and locks) the next item; null if the queue is empty
Process Queuequeue-process—Empties the whole queue: takes each item, runs your logic and reports the result (the performer in a single activity)
Set Transaction Statusqueue-set-transaction-status—Marks an item as successful or failed
Postpone Transactionqueue-postpone-transaction—Returns the item to the queue and defers it (without counting the attempt)

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:

FieldTypeWhat for
item.IdstringUnique identifier (UUID): you need it to report the status.
item.QueueIdstringQueue id.
item.ReferencestringThe reference the producer gave it (null if none).
item.StatusstringCurrent status: new, in_progress, successful, failed, business_exception, abandoned, retried, review or waiting_decision (waiting for its human task’s decision).
item.SpecificContent["field"]DictionaryThe payload: the data the bot must process.
item.Prioritystringhigh, normal or low.
item.AttemptsintHow many attempts have been made on this item (including the current one).
item.OutputDictionaryThe stored result (if it finished successfully); null if none.
item.ExceptionDictionaryThe error detail (if it failed); null if none.
item.ProgressstringLast progress message reported.
item.DeferUntilstringDate (ISO 8601, UTC) before which it isn’t handed out; null if not deferred.
item.ProcessingStartedAt / item.ProcessedAt / item.CreatedAtstringWhen processing started, when it finished and when it was enqueued (ISO 8601, UTC).
item.HumanTaskIdstringId of the linked human task, if any.
item.HasDecisionbooltrue if the item had a linked human task that has been decided, expired or cancelled.
item.Decision.ValuestringThe 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"].

Normally there are two playbooks (published as two processes).

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.

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 }