Queue / Task manager

The queue runs a function in the background, possibly on another node, so nobody waits for it. Use it for slow work that need not finish right now, such as generating a PDF.

Use the queue for work a user should not wait for

Large systems need to offload work to other nodes, and doing that by hand is cumbersome. The queue makes it one block.

Generating a PDF is the classic case: it is computationally intensive, and having it ready this instant is not critical enough to keep the user waiting. Create a custom function that generates the PDF and notifies the user by email. Requested inside the same flow, it would delay the user, so a queue item decouples it from the main flow.

queue block
A queue block
A queue block

Give the queue block a function to run

Add function_custom_execute_from_queue and choose the function. It runs that function in the background without waiting for it. It may run on another node or thread: the queue abstracts the location away and aims to execute as closely to the specified time as feasible.

Its in-pins set the time (Execute at) and guard against duplicates (unique ID, Debounce). Every in-pin is described in the block documentation.

Queue items are postponed automatically under load

Each license has a limit on how many queue items can execute at once. It lets you build fast, high-performance functions, and keeps the system from congesting with running queue items.

When you create many queue items at once, the system adds a few seconds to the execution time of each item, to distribute the workload more evenly.

Watch queue items in RUAL Studio

Open Queue in the left-side menu of RUAL Studio. It lists the currently executing, scheduled and completed queue items, so you can see whether and when each one ran.

The page is quasi-real-time. Items move between the tables as they progress, with a delay of a few seconds: the data comes from the backend but is not updated live, to keep the system fast.

queue overview
A queue overview
A queue overview

Next steps

Repeating Events Schedule work on an interval, through the same queue. Background work patterns The queue next to storage events and repeating events.

Frequently asked

When should I use the queue in RUAL?

Use the queue for work that is slow or bursty, so the calling flow does not wait for it. Tasks are handed to the queue and executed separately, and you can monitor what each task did.