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.