Skip to main content

Advanced Queue Playbook

These examples illustrate how to orchestrate non-trivial workflows with Ziva:
  • split a process into multiple stages and append tasks dynamically;
  • react to user choices and task outcomes;
  • recover from errors without leaving the TUI.
All snippets rely on the public ziva API. Keep them in an examples package and call the helpers when you need to demonstrate behaviour.

Multi-stage deployment template

Highlights

  • Two queue runs. The first queue captures input; the second queue is assembled at runtime.
  • Summary function. WithSummaryFunction displays a concise recap under the task and improves operator feedback.
  • Timeouts. WithTimeout prevents headless sessions from hanging indefinitely.

Retrying with user confirmation

When to use it

  • flaky infrastructure calls;
  • firmware updates over unstable connections;
  • long-running operations that deserve a human-confirmed retry.

Building tasks on the fly

If a workflow can generate hundreds of tasks, split the execution into several queues and run them in batches to keep memory usage predictable.

Quick checklist for complex flows

  • Keep references to tasks whose results you need later.
  • Use separate queues for distinct stages — it simplifies reasoning and module tests.
  • Call AutoConfigure() on startup so Ziva tunes itself for the target environment.
  • Combine EnableEmbeddedMode() with WithOutResultLine() on constrained devices to keep the output compact.
  • Remember that the queue is sequential; if you need pseudo-parallel work, launch extra queues from FuncTask handlers.
Continue with the validation demo to see how to compose robust forms.