Skip to content

Commit

Permalink
Merge pull request #216 from camunda/fix-activate-jobs-alpha
Browse files Browse the repository at this point in the history
feat(zeebe): fix activate jobs stream
  • Loading branch information
jwulf authored Jul 29, 2024
2 parents 70c9954 + 68bb5da commit 9810672
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/zeebe/zb/ZeebeGrpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,21 @@ export class ZeebeGrpcClient extends TypedEmitter<
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
const jobs: ZB.Job<Variables, CustomHeaders>[] = []

const stream = await (await this.grpc).activateJobsStream(req)
stream.on('data', (res: Grpc.ActivateJobsResponse) => {
const jobs = res.jobs.map((job) =>
const parsedJobs = res.jobs.map((job) =>
parseVariablesAndCustomHeadersToJSON<Variables, CustomHeaders>(
job,
inputVariableDtoToUse,
customHeadersDtoToUse
)
)
jobs.push(...parsedJobs)
})

stream.on('end', () => {
resolve(jobs)
})
} catch (e: unknown) {
Expand Down

0 comments on commit 9810672

Please sign in to comment.