WJb Docs - Reference

Browse APIs, configuration options, interfaces, and implementation details.

⚡ Actions
🔀 Workflow
📦 Jobs
⚙️ Runtime
💾 Persistence
🗄 Storage
🧩 Workflow Metadata
🛠 Extensions & Helpers

IAction / IAction

Represents executable business logic in WJb.

Actions are the foundation of every workflow. A job ultimately resolves to an action, executes business logic, and returns an IActionResult describing what should happen next.

Purpose

Use actions to:

  • Execute business logic
  • Access application services
  • Validate input
  • Call external APIs
  • Produce workflow transitions
An action should focus on a single responsibility.

Execution Flow

Job
 ↓
IAction
 ↓
IActionResult
 ↓
JobCommand

IAction

Non-generic action contract.

Use when no strongly typed payload is required or when custom payload handling is preferred.

public interface IAction
{
    ...
}

IAction

Strongly typed action contract.

The generic parameter represents the job payload.

public interface IAction<T>
{
    ...
}

When to Use IAction

Recommended for most scenarios.

Benefits:

  • Strong typing
  • Compile-time validation
  • Better IntelliSense support
  • Easier maintenance
Example payloads:

EmailRequest
ImportRequest
InvoiceRequest
UserNotification

Action Lifecycle

Job Enqueued
     ↓
Action Resolved
     ↓
Action Executed
     ↓
Result Returned
     ↓
Commands Generated

Best Practices

Keep Actions Small

Good:

ValidateUser
SendEmail
GenerateInvoice
UploadFile

Avoid:

ValidateUserGenerateInvoiceSendEmailUpdateDatabase

Keep Actions Focused

An action should perform one business operation.

Complex workflows should be composed from multiple actions.

Return Results Explicitly

Workflow behavior should be expressed through action results rather than hidden side effects.

Dependency Injection

Actions can consume services through constructor injection.

public sealed class SendEmailAction : JobAction<SendEmailRequest>
{
    private readonly IEmailSender sender;

public SendEmailAction(IEmailSender sender) { this.sender = sender; } }

Relationship to JobAction

Most applications use JobAction rather than implementing action interfaces directly.

JobAction provides a convenient base class and reduces boilerplate code.

Related Types

  • JobAction
  • IActionResult
  • Results
  • JobCommand
  • JobInfo
  • IActionFactory
  • IProgressAction

See Also

  • JobAction
  • IActionResult
  • Results
  • NextResult
  • JobCommand
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.