Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

Type parameters

  • WorkerInputVariables

  • CustomHeaderShape

  • WorkerOutputVariables

Hierarchy

  • ZBWorkerBase<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>
    • ZBWorker

Index

Constructors

constructor

  • new ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>(config: ZBWorkerConstructorConfig<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>): ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>
  • Type parameters

    • WorkerInputVariables

    • CustomHeaderShape

    • WorkerOutputVariables

    Parameters

    • config: ZBWorkerConstructorConfig<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

    Returns ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

Properties

activeJobs

activeJobs: number = 0

Protected cancelWorkflowOnException

cancelWorkflowOnException: boolean = false

grpcClient

grpcClient: ZBGrpc

jobBatchMinSize

jobBatchMinSize: number

Protected logger

logger: StatefulLogInterceptor

maxJobsToActivate

maxJobsToActivate: number

pollCount

pollCount: number = 0

Protected taskHandler

taskHandler: ZBBatchWorkerTaskHandler<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables> | ZBWorkerTaskHandler<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

taskType

taskType: string

timeout

timeout: MaybeTimeDuration

Protected zbClient

zbClient: ZBClient

Methods

close

  • close(timeout?: number): Promise<null>
  • Returns a promise that the worker has stopped accepting tasks and has drained all current active tasks. Will reject if you try to call it more than once.

    Parameters

    • Optional timeout: number

    Returns Promise<null>

debug

  • debug(msg: any): void

Protected drainOne

  • drainOne(): void

emit

  • emit<K>(eventName: K, params?: { close: "close"; connectionError: "connectionError"; ready: "ready"; unknown: "unknown" }[K]): void
  • Type parameters

    • K: EventKey<{ close: "close"; connectionError: "connectionError"; ready: "ready"; unknown: "unknown" }>

    Parameters

    • eventName: K
    • Optional params: { close: "close"; connectionError: "connectionError"; ready: "ready"; unknown: "unknown" }[K]

    Returns void

error

  • error(msg: any): void

Protected handleJob

  • handleJob(job: Job<WorkerInputVariables, CustomHeaderShape>): Promise<void>

Protected handleJobs

  • handleJobs(jobs: Job<WorkerInputVariables, CustomHeaderShape>[]): void
  • Parameters

    • jobs: Job<WorkerInputVariables, CustomHeaderShape>[]

    Returns void

log

  • log(msg: any): void

Protected makeCompleteHandlers

off

  • off<K>(eventName: K, fn: EventReceiver): void
  • Type parameters

    • K: EventKey<{ close: "close"; connectionError: "connectionError"; ready: "ready"; unknown: "unknown" }>

    Parameters

    • eventName: K
    • fn: EventReceiver

    Returns void

on

  • on<K>(eventName: K, fn: EventReceiver): ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>
  • Type parameters

    • K: EventKey<{ close: "close"; connectionError: "connectionError"; ready: "ready"; unknown: "unknown" }>

    Parameters

    • eventName: K
    • fn: EventReceiver

    Returns ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>

removeAllListeners

  • removeAllListeners(): void

Generated using TypeDoc