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

πŸ“Š Job Status & Results

Every job in WJb has a clear status and can carry a result or an error.

You can inspect this information at any time through the store.


Job Statuses

Typical lifecycle:

Pending
   ↓
Running
   ↓
Completed   or   Failed
  • Pending β€” waiting in the store
  • Running β€” currently being executed
  • Completed β€” finished successfully
  • Failed β€” finished with an exception

Retrieving a Single Job

var job = await store.GetJobAsync(jobId);

The returned object usually contains:

  • Job ID
  • Action name
  • Status
  • Payload
  • Result (if completed)
  • Error (if failed)
  • Progress information
  • Timestamps

Querying Multiple Jobs

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

Useful for dashboards, monitoring, and administrative tools.


Job Result

When an action returns a value:

return Results.Complete(
    new
    {
        OrderId = 123,
        Total = 99.50m
    });

The value is stored as the job result and can be read later:

var job = await store.GetJobAsync(jobId);

if (job.Status == JobStatus.Completed) { var result = job.Result; // use the result }

Scalar results work the same way:

return Results.Complete("done");
return Results.Complete(42);

Error Information

When a job fails, the store keeps the error details:

if (job.Status == JobStatus.Failed)
{
    var error = job.Error;
    // log or display the error
}

Example Inspection Flow

var job = await store.GetJobAsync(jobId);

switch (job.Status) { case JobStatus.Completed: Console.WriteLine("Result: " + job.Result); break;

case JobStatus.Failed: Console.WriteLine("Error: " + job.Error); break;

case JobStatus.Running: Console.WriteLine("Still running..."); break;

case JobStatus.Pending: Console.WriteLine("Waiting to be executed"); break; }


Key Point

Status and results are first-class data.

You never need to guess what happened β€” the store gives you a clear record of every job’s outcome.

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.