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
π How to Read a Workflow
A WJb workflow is just a chain of actions connected by results.
Reading it is straightforward once you know where to look.
Step 1 β Find the Starting Action
Locate the action that is enqueued first.
await wjb.EnqueueAsync("send-email",
new EmailInput { To = "user@test.com" });
or
await wjb.EnqueueAsync<SendEmailAction>(...);
This is the entry point of the workflow.
Step 2 β Open the Action
Look at the ExecuteAsync method.
public override async Task<IActionResult> ExecuteAsync(
EmailInput input, CancellationToken ct)
{
// business logic
return await NextAsync<LogAction>(
new LogInput { Message = "Email sent" });
}
Two questions matter:
1. What work does this action perform? 2. What does it return?
Step 3 β Follow the Result
Complete
return await CompleteAsync();
or
return Results.Complete(someValue);
β The workflow ends here.
Next
return await NextAsync<LogAction>(...);
or
return Results.Next(
JobCommands.Next<LogAction>(...),
JobCommands.Next<AuditAction>(...));
β Follow each listed action.
Step 4 β Repeat
Open the next action and repeat the same process until you reach Complete.
Full Example
SendEmailAction
β
LogAction
β
Complete
// SendEmailAction
return await NextAsync<LogAction>(
new LogInput { Message = $"Email sent to {input.To}" });
// LogAction
Console.WriteLine(input.Message);
return await CompleteAsync();
Reading the two methods is enough to understand the entire workflow.
Multiple Branches
When an action returns several commands:
return Results.Next(
JobCommands.Next<LogAction>(...),
JobCommands.Next<AuditAction>(...));
The workflow becomes:
βββ LogAction
SendEmail
βββ AuditAction
Read each branch independently.
Quick Checklist
When you open any action, ask:
- What does this action do?
- Does it complete the workflow?
- Which actions does it schedule next?
- What data does it pass forward?
Key Point
You never need to look for hidden configuration or middleware.
The workflow is fully described by the code of the actions themselves.