WJb Docs - Basic
Start here with installation, quick starts, and core concepts.
π Start Here
β¨ First Steps
β Next Steps
π First Workflow
A workflow is simply a chain of Actions.
Each Action decides what should run next.
Create two Actions
using WJb;
public sealed class GreetAction : JobAction<string>
{
public override Task<IActionResult> ExecuteAsync(
string name, CancellationToken ct)
{
Console.WriteLine($"Hello, {name}!");
return NextAsync<LogAction>($"Greeted {name}");
}
}
public sealed class LogAction : JobAction<string>
{
public override Task<IActionResult> ExecuteAsync(
string message, CancellationToken ct)
{
Console.WriteLine($"Log: {message}");
return CompleteAsync();
}
}
Register both Actions
var store = new InMemoryStore();
var wjb = WJbBuilder.Create(store, cfg =>
{
cfg.AddAction<GreetAction>("greet");
cfg.AddAction<LogAction>("log");
})
.Build(store);
Run the workflow
await wjb.EnqueueAsync("greet", "Alice");
await wjb.ExecuteOnceAsync(); // runs GreetAction
await wjb.ExecuteOnceAsync(); // runs LogAction
What happens
GreetAction
β
LogAction
β
Complete
1. GreetAction prints the greeting.
2. It explicitly schedules LogAction.
3. LogAction writes the log message.
4. The workflow finishes.
Key idea
The next step is decided inside the Action using NextAsync.
Nothing is hidden.