createInProcessWorker
createInProcessWorker<
TJobTypeDefinitions,TStateAdapter,TProcessorsInput,TRequiredAttemptMiddleware>(options):Promise<InProcessWorker>
Defined in: packages/core/src/in-process-worker.ts:266
Create an in-process worker for processing jobs.
Per-attempt configuration (attemptMiddleware, backoffConfig,
attemptConfig) lives on the processor registry (see createProcessors).
The worker dispatches to whichever processor matches the job’s typeName and
runs that slice’s middleware chain. Worker-level defaults provide fallbacks
for processors that don’t set backoffConfig / attemptConfig themselves;
precedence is processor > worker defaults > built-in defaults.
Type Parameters
Section titled “Type Parameters”TJobTypeDefinitions
Section titled “TJobTypeDefinitions”TJobTypeDefinitions extends BaseJobTypeDefinitions
TStateAdapter
Section titled “TStateAdapter”TStateAdapter extends StateAdapter<any, any>
TProcessorsInput
Section titled “TProcessorsInput”TProcessorsInput extends Processors | readonly Processors[] = Processors
TRequiredAttemptMiddleware
Section titled “TRequiredAttemptMiddleware”TRequiredAttemptMiddleware extends readonly AnyAttemptMiddleware[] = readonly []
Parameters
Section titled “Parameters”options
Section titled “options”Worker configuration.
client
Section titled “client”Client<TJobTypeDefinitions, TStateAdapter>
The Queuert client to process jobs for.
concurrency?
Section titled “concurrency?”number
Maximum number of jobs to process in parallel. Defaults to 1.
defaults?
Section titled “defaults?”Fallback backoffConfig / attemptConfig for processors that don’t set their own.
pollIntervalMs?
Section titled “pollIntervalMs?”number
How often to poll for new jobs when no notify adapter wakes the worker. Defaults to 60s.
processors
Section titled “processors”[ExtraProcessorTypeNames<WorkerProcessorDefs<TProcessorsInput>, TJobTypeDefinitions>] extends [never] ? ValidateRequiredMiddleware<TProcessorsInput, TRequiredAttemptMiddleware> : `Error: processors contain job types unknown to the client: ${ExtraProcessorTypeNames<WorkerProcessorDefs<TProcessorsInput>, TJobTypeDefinitions> & string}`
A single Processors from createProcessors, or an array of slices to merge.
recoveryBackoffConfig?
Section titled “recoveryBackoffConfig?”Backoff configuration for the worker loop itself (not job retries).
requiredAttemptMiddleware?
Section titled “requiredAttemptMiddleware?”TRequiredAttemptMiddleware & readonly AttemptMiddleware<TStateAdapter, any, any, any, any>[]
Middleware instances that every dispatched processor’s slice must include
as an in-order subsequence. Enforced both at compile time (against the
slice middleware tuple inferred by createProcessors) and at runtime
by reference-identity (===). The worker does not execute this middleware
itself — slices run their own chains.
Same adapter guard as createProcessors’s attemptMiddleware.
workerName?
Section titled “workerName?”string
Optional human-readable label included in the worker id (which is always
suffixed with a random UUID to guarantee uniqueness across replicas). Must
match /^[A-Za-z0-9._-]+$/ when provided.
Returns
Section titled “Returns”Promise<InProcessWorker>