Interface ZBWorkerConfig<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

Type Parameters

  • WorkerInputVariables

  • CustomHeaderShape

  • WorkerOutputVariables

Hierarchy

Properties

connectionTolerance?: MaybeTimeDuration

If your Grpc connection jitters, this is the window before the connectionError

debug?: boolean

Enable debug tracking

failProcessOnException?: boolean

If a handler throws an unhandled exception, if this is set true, the process will be failed. Defaults to false.

fetchVariable?: (keyof WorkerInputVariables)[]

Constrain payload to these keys only.

id?: string

A custom id for the worker. If none is supplied, a UUID will be generated.

jobBatchMinSize?: number

The minimum amount of jobs to fetch. The worker will request more jobs only when it has capacity for this many jobs. Defaults to 0, meaning the worker will fetch more jobs as soon as it as any capacity.

logNamespace?: string
loglevel?: Loglevel

A log level if you want it to differ from the ZBClient

longPoll?: MaybeTimeDuration

A custom longpoll timeout. By default long polling is every 30 seconds.

maxJobsToActivate?: number

Max concurrent tasks for this worker. Default 32.

onConnectionError?: (() => void)

Type declaration

    • (): void
    • This handler is called when the worker cannot connect to the broker, or loses its connection.

      Returns void

onConnectionErrorHandler?: ConnectionErrorHandler

This handler is called when the worker cannot connect to the broker, or loses its connection.

onReady?: (() => void)

Type declaration

    • (): void
    • This handler is called when the worker (re)establishes its connection to the broker

      Returns void

pollInterval?: MaybeTimeDuration

Poll Interval in ms. Default 100.

An implementation of the ZBCustomLogger interface for logging

taskHandler: ZBWorkerTaskHandler<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

A job handler - this must return a job action - e.g.: job.complete(), job.error() - in all code paths.

taskType: string

The task type that this worker will request jobs for.

timeout?: MaybeTimeDuration

Max seconds to allow before time out of a job given to this worker. Default: 30s. The broker checks deadline timeouts every 30 seconds, so an

Generated using TypeDoc