@camunda8/sdk
    Preparing search index...

    Interface CamundaJobWorkerConfig<VariablesDto, CustomHeadersDto>

    Request object to send the broker to request jobs for the worker.

    interface CamundaJobWorkerConfig<
        VariablesDto extends LosslessDto,
        CustomHeadersDto extends LosslessDto,
    > {
        autoStart?: boolean;
        customHeadersDto?: Ctor<CustomHeadersDto>;
        fetchVariable?: string[];
        inputVariableDto?: Ctor<VariablesDto>;
        jobHandler: (
            job: RestJob<VariablesDto, CustomHeadersDto> & JobCompletionInterfaceRest<
                IProcessVariables,
            >,
            log: Logger,
        ) => MustReturnJobActionAcknowledgement;
        logger?: Logger;
        maxBackoffTimeMs?: number;
        maxJobsToActivate: number;
        pollIntervalMs?: number;
        requestTimeout?: MaybeTimeDuration;
        tenantIds?: string[];
        timeout: MaybeTimeDuration;
        type: string;
        worker: string;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    autoStart?: boolean

    Default: true. Start the worker polling immediately. If set to false, call the worker's start() method to start polling for work.

    customHeadersDto?: Ctor<CustomHeadersDto>

    An optional LosslessDto class to decode the job custom headers. This provides both runtime safety for int64 numbers and design-time type hinting.

    fetchVariable?: string[]

    A list of variables to fetch as the job variables; if empty, all visible variables at the time of activation for the scope of the job will be returned

    inputVariableDto?: Ctor<VariablesDto>

    An optional LosslessDto class to decode the job variables. This provides both runtime safety for int64 numbers and design-time type hinting.

    jobHandler: (
        job: RestJob<VariablesDto, CustomHeadersDto> & JobCompletionInterfaceRest<
            IProcessVariables,
        >,
        log: Logger,
    ) => MustReturnJobActionAcknowledgement

    A callback function that is invoked for an activated job. All return paths must return the output from one of the job acknowledgement methods. This is done to ensure that job handlers do not have logic paths that neglect to acknowledge the job.

    logger?: Logger

    An optional logger instance.

    maxBackoffTimeMs?: number

    The worker will back off polling for jobs if the poll request fails. This is to prevent overwhelming the broker with requests. The backoff time will double with each failed request, up to the maximum backoff time. The backoff time will be reset to the initial poll interval when a successful request is made. This can be set explicitly here, or it will be set to the value of CAMUNDA_JOB_WORKER_MAX_BACKOFF_MS in the environment.

    maxJobsToActivate: number

    The maximum jobs to activate by this request

    pollIntervalMs?: number

    How often the worker will poll for new jobs. Defaults to 300ms.

    requestTimeout?: MaybeTimeDuration

    The request will be completed when atleast one job is activated or after the requestTimeout. if the requestTimeout = 0, the request will be completed after a default configured timeout in the broker. To immediately complete the request when no job is activated set the requestTimeout to a negative value

    tenantIds?: string[]

    a list of IDs of tenants for which to activate jobs

    timeout: MaybeTimeDuration

    The duration the broker allows for jobs activated by this call to complete before timing them out releasing them for retry on the broker. The broker checks time outs every 30 seconds, so the broker timeout is guaranteed in at-most timeout + 29s be guaranteed.

    type: string

    The job type, as defined in the BPMN process (e.g. <zeebe:taskDefinition type="payment-service" />)

    worker: string

    The name of the worker activating the jobs, mostly used for logging purposes