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
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.