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

πŸ”„ Requeue

Requeue moves an existing job back into the pending state so it can be executed again.

It is useful for manual recovery or custom retry logic.


Basic Usage

await store.RequeueAsync(jobId);

or through the higher-level API when available:

await wjb.RequeueAsync(jobId);

The job returns to the queue and becomes available for workers.


Typical Scenarios

1. Manual recovery

A job failed and an operator fixed the external problem (SMTP server is back, file is now available, etc.).

// after fixing the issue
await store.RequeueAsync(failedJobId);

2. Custom retry logic

You decide in code whether a failed job should be tried again:

var job = await store.GetJobAsync(jobId);

if (ShouldRetry(job)) await store.RequeueAsync(jobId);

3. After inspection

You examine the payload or error, correct something externally, then requeue.


What Requeue Does

  • Sets the job status back to Pending (or the equivalent ready state)
  • Keeps the original payload
  • Clears or preserves error information depending on the store implementation
  • Makes the job eligible for execution again
It does not create a new job β€” it reuses the existing one.

Requeue vs Automatic Retry

| Feature | Automatic Retry | Manual Requeue | |----------------------|--------------------------|-----------------------------| | Trigger | Built-in policy | Explicit call | | Delay | Configured in options | Immediate (or you wait) | | Attempt counting | Usually tracked | Not automatic | | Use case | Transient errors | Operator recovery / custom logic |


Example Flow

Job executes
    ↓
Throws exception β†’ Failed
    ↓
Operator inspects and fixes the problem
    ↓
RequeueAsync(jobId)
    ↓
Job becomes Pending again
    ↓
Worker picks it up and executes once more

Best Practices

  • Prefer automatic retry for common transient failures
  • Use requeue for human-driven recovery or advanced policies
  • Always log why a job was requeued
  • Consider whether the action is idempotent before requeueing

Key Point

Requeue gives you full control to put a job back into the execution pipeline when automatic retry is not enough.

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.