Skip to content

Process Queue

Type: queue-process  ·  Package: Queue Activities v1.0.0  ·  Output:

A container activity (like For Each) that drains a queue for you: on each turn it takes the next item with an atomic lock, runs the body you define with the item in scope, and sets the result automatically (successful if the body finishes, failed if it throws). It repeats until the queue is empty.

It is the consumer (performer) pattern in a single activity: it encapsulates the While + Get Queue Item + Try/Catch + Set Transaction Status loop so you don’t have to wire it by hand every time.

On each iteration:

  1. Takes the next item from the queue (atomic, locks it for this execution). If the queue is empty, the loop ends.
  2. Exposes the item in the variable you choose (itemVariable, typed ZoanQueueItem).
  3. Runs the body (your sub-activities).
  4. Reports the status automatically:
    • the body finishes without error → successful;
    • the body throws an exception → failed (honors the queue’s auto_retry).
  5. Goes back to step 1.
ParameterEditorDescription
queueNameexpressionQueue name. It must exist in the execution environment.
itemVariableidentifierName of the variable that receives the current item (ZoanQueueItem).
activitiesbodyThe activities that run for each item.
ParameterEditorDescription
maxItemsnumberMaximum number of items to process. Empty = until the queue is empty.
onErrorlistOn a failing item: continue (mark it failed and go to the next one — default) or stop (mark it failed and stop the loop).

The full performer, in a single block:

Process Queue
queueName = "facturas-por-validar"
itemVariable = item
onError = continue
└─ body:
(… process = item.SpecificContent["facturaId"] …)
Set Variable validated = true

You don’t need While, a null check, Try/Catch, or to close the transaction: if the body finishes, the item is left successful; if something inside throws, it is left failed and the loop continues with the next one.

Process Queue does exactly this for you:

While condition = =true
└─ body:
Get Queue Item queueName = "facturas-por-validar" → output: item
If condition = =item == null
└─ then: Break
Try
└─ body: (… process …) · Set Transaction Status item = =item status = successful
└─ catch: Set Transaction Status item = =item status = failed

Use the manual form only if you need fine control (batches, custom retries, postponing with Postpone Transaction).