WJb Docs - Reference
Browse APIs, configuration options, interfaces, and implementation details.
⚡ Actions
🔀 Workflow
📦 Jobs
⚙️ Runtime
💾 Persistence
🗄 Storage
🧩 Workflow Metadata
🛠 Extensions & Helpers
JobAction<T>
Provides a base class for implementing strongly typed WJb actions.
JobAction is the recommended starting point for most application actions. It simplifies action development by combining the WJb execution model with a strongly typed payload.
Purpose
Use JobAction when creating business actions that operate on a specific request model.
Benefits include:
- Strongly typed payloads
- Improved readability
- Reduced boilerplate code
- Better IntelliSense support
- Easier testing
Inheritance
IAction
↑
IAction<T>
↑
JobAction<T>
↑
Your Action
Typical Usage
public sealed class SendEmailAction : JobAction<SendEmailRequest>
{
public override Task<IActionResult> ExecuteAsync(
SendEmailRequest request,
CancellationToken cancellationToken)
{
return Task.FromResult(Results.Complete());
}
}
Generic Parameter
The generic parameter represents the job payload.
JobAction<SendEmailRequest>
JobAction<ImportRequest>
JobAction<CreateInvoiceRequest>
Each job instance receives a deserialized payload of the specified type.
Execution Flow
Job
↓
Payload Deserialized
↓
JobAction<T>
↓
IActionResult
↓
JobCommand
Returning Results
Actions do not directly enqueue or execute additional work.
Instead, actions return an IActionResult.
Common outcomes include:
Results.Complete()
Results.Next(...)
The executor converts results into workflow commands.
Dependency Injection
Application services can be injected through the constructor.
public sealed class GenerateInvoiceAction : JobAction<GenerateInvoiceRequest>
{
private readonly IInvoiceService invoices;
public GenerateInvoiceAction(IInvoiceService invoices)
{
this.invoices = invoices;
}
}
Best Practices
One Action, One Responsibility
Prefer:
ValidateOrderAction
GenerateInvoiceAction
SendEmailAction
Avoid:
ProcessEntireBusinessWorkflowAction
Use Strongly Typed Models
Prefer request objects over dictionaries or loosely typed data.
public sealed class ImportCustomerRequest
{
public int CustomerId { get; set; }
}
Keep Actions Stateless
Store persistent data in payloads, stores, or external services.
Avoid keeping execution state inside action instances.
When to Use
Use JobAction for nearly all application-level actions.
Only implement IAction or IAction directly when creating custom framework integrations, infrastructure components, or specialized execution behavior.
Related Types
- IAction
- IAction
- IActionResult
- Results
- JobCommand
- JobInfo
- IProgressAction
See Also
- IAction / IAction
- IActionResult
- Results
- JobCommand
- IProgressAction