I am using the following library https://github.com/camunda-community-hub/zeebe-client-node-js
I am having issues handling RESOURCE_EXHAUSTED exceptions I tried all the configurations that the library suggests.
I want to achieve the following : try to activate the job 5 times and after that I want to quit
class MyCamunda {
constructor() {
this.zbClient = new ZBClient({
onReady: () => console.log("broker connected")
})
this.pollUserTask();
}
userTask() {
this.zbClient.createWorker({
taskType: 'io.camunda.zeebe:userTask',
taskHandler: async () => {
// handle the task
},
onReady: () => console.log("worker ready"),
onConnectionError: () => console.log("worker error")
})
}
async pollUserTask() {
try {
const response = await this.zbClient.activateJobs({
type: 'io.camunda.zeebe:userTask',
maxJobsToActivate:20,
timeout: 60 * 1000,
worker: 'test',
requestTimeout: 5000
})
// handle the task
} catch (error) {
console.log("error",error)
} finally {
setTimeout(() => this.pollUserTask(),5000);
}
}
}
I tried to poll the userTasks from the broker but when calling the activateJobs method the application gets stuck it will not resume the execution flow. (seen in the pollUserTask method)
I would expect to get all the userTasks 0..n and I would expect that I would be able to handle the exceptions when they are thrown.