Overview
Processor is the async function type that receives jobs and processes them. It’s the core of a Worker’s job processing logic.
Type Definition
Parameters
job
token
Worker token for the job (used internally for locking)
signal
Abort signal for job cancellation
Return Value
The result value that will be stored as the job’s return value
Examples
Basic Processor
Typed Processor
With Progress Updates
With Logging
With Abort Signal
Error Handling
Accessing Job Properties
Parent-Child Jobs
Sandboxed Processors
Processors can also be defined in separate files:
Best Practices
1. Keep Processors Idempotent
2. Use Proper Error Types
3. Handle Long-Running Operations
- Job - The job class passed to processors
- Worker - The worker class that runs processors