WJb Docs - Intermediate

Learn workflows, persistence, scheduling, and production-ready patterns.

πŸš€ Start Here
🧩 Mental Model
🌊 Building Workflows
πŸ’₯ Failures & Control
πŸ‘€ Observation & Debugging
πŸ›  Practical Patterns
βœ… Working Examples
➑️ What’s Next

πŸ”Ž Observing Execution

WJb makes every job observable.

You can inspect the full lifecycle of a job at any moment.


What You Can Observe

For every job you can see:

  • Current status (Pending, Running, Completed, Failed)
  • Original payload
  • Result (when completed)
  • Error details (when failed)
  • Progress percentage and message
  • Timestamps (created, started, completed)
  • Action name
All of this lives in the store.

Reading a Job

var job = await store.GetJobAsync(jobId);

Console.WriteLine($"Action : {job.Action}"); Console.WriteLine($"Status : {job.Status}"); Console.WriteLine($"Progress: {job.Progress}%"); Console.WriteLine($"Message : {job.Message}");


Querying Jobs

var jobs = await store.GetJobsAsync(new JobQuery
{
    // filter by status, date, action name, etc.
});

Useful for building dashboards or administrative tools.


Real-time Monitoring

The recommended way to observe execution in real applications is the official UI:

WJb.UI.Blazor

It provides:

  • Live list of jobs
  • Status filtering
  • Progress visualization
  • Payload and result viewer
  • Error inspection
  • Retry and cancel buttons
You can also build your own monitoring using the store APIs.

Typical Observation Flow

1. Enqueue a job β†’ receive jobId
2. Poll GetJobAsync(jobId) or use the UI
3. Watch status change:
   Pending β†’ Running β†’ Completed / Failed
4. Read the final result or error

Example Polling Loop

while (true)
{
    var job = await store.GetJobAsync(jobId);

Console.WriteLine($"{job.Status} - {job.Progress}%");

if (job.Status is JobStatus.Completed or JobStatus.Failed) break;

await Task.Delay(1000); }

if (job.Status == JobStatus.Completed) Console.WriteLine("Result: " + job.Result); else Console.WriteLine("Error: " + job.Error);


Key Point

Because every transition is stored explicitly, you never have to guess what a job is doing.

Observation is a first-class feature of WJb, not an afterthought.

An unhandled error has occurred. Reload πŸ—™

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.