pickProcessors
FunctionSignature
function pickProcessors<TProcessors, TTypeNames>(processors, typeNames): Pick<ProcessorDefinitions<TProcessors>, TTypeNames[number]> extends TPickedDefinitions ? Processors<TPickedDefinitions, ProcessorMiddlewareTuple<TProcessors>> : never;core/src/job-type-processors/pick-job-type-processors.ts:51
Create a registry holding only the listed job types of processors, e.g. to run them on a
dedicated worker. Each picked processor keeps its handler, its middleware chain and its
backoffConfig.
Type Parameters
- TProcessorsextends
Processors - TTypeNamesextends readonly [
JobTypeNames<ProcessorDefinitions<TProcessors>>,JobTypeNames<ProcessorDefinitions<TProcessors>>]
Parameters
- processors
TProcessors - typeNames
TTypeNames
Returns
Pick<ProcessorDefinitions<TProcessors>,TTypeNames[number]> extends TPickedDefinitions ? Processors<TPickedDefinitions,ProcessorMiddlewareTuple<TProcessors>> : never
Example
TypeScript
const imageWorkerRunner = createWorkerRunner({
client,
processors: pickProcessors(appProcessors, ["images.resize", "images.transcode"]),
});Throws
if the list is empty, or a listed job type has no processor in processors.