camunda-community-hub / zeebe-client-node-js

Node.js client library for Zeebe Microservices Orchestration Engine
https://camunda-community-hub.github.io/zeebe-client-node-js/
Apache License 2.0
152 stars 38 forks source link

fetchVariable does not have effect on job workers #264

Closed veckatimest closed 2 years ago

veckatimest commented 2 years ago

There is a createWorker method of zbClient. It uses this configuration:

export interface ZBWorkerOptions<InputVars = IInputVariables> {
    maxJobsToActivate?: number
        // ... other fields
    fetchVariable?: (keyof InputVars)[]
}

Expected Behavior

When I use fetchVariable option, I only receive specified variables in my job executor.

Current Behavior

I receive all variables

Possible Solution

Feels like library uses ActivateJobRequest from src/lib/interfaces-grpc-1.0.ts to fetch jobs.

And there is activateJobs method in the ZBWorkerBase.ts, that fetches jobs.

// some code
        const activateJobsRequest: ActivateJobsRequest = {
            maxJobsToActivate: amount,
            requestTimeout,
            timeout: this.timeout,
            type: this.taskType,
            worker: this.id,
        }

This request does not have fetchVariable in it, so I guess this is the problem (but the type does)

Steps to Reproduce

  1. create a worker
  2. add fetchVariable
  3. check what variables you received
jwulf commented 2 years ago

This is fixed in 8.0.3 of the client library.