Skip to content

Commit

Permalink
Merge pull request #217 from camunda/alpha
Browse files Browse the repository at this point in the history
Merge for release.
  • Loading branch information
jwulf authored Jul 29, 2024
2 parents dd5717e + 7f347c6 commit 3fa2715
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/__tests__/config/jest.cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const cleanUp = async () => {
await zeebe.cancelProcessInstance(key)
console.log(`Cancelled process instance ${key}`)
} catch (e) {
console.log(e)
if (!(e as Error).message.startsWith('5 NOT_FOUND')) {
console.log('Failed to cancel process instance', key)
console.log((e as Error).message)
Expand Down
5 changes: 5 additions & 0 deletions src/lib/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ const getMainEnv = () =>

const getZeebeEnv = () =>
createEnv({
ZEEBE_INSECURE_CONNECTION: {
type: 'boolean',
optional: true,
default: false,
},
/** Log level of Zeebe Client and Workers - 'DEBUG' | 'INFO' | 'NONE'. Defaults to 'INFO' */
ZEEBE_CLIENT_LOG_LEVEL: {
type: 'string',
Expand Down
11 changes: 9 additions & 2 deletions src/zeebe/zb/ZeebeGrpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export class ZeebeGrpcClient extends TypedEmitter<
this.maxRetryTimeout = Duration.seconds.of(
config.zeebeGrpcSettings.ZEEBE_GRPC_CLIENT_MAX_RETRY_TIMEOUT_SECONDS
)
this.useTLS = config.CAMUNDA_SECURE_CONNECTION
this.useTLS =
config.CAMUNDA_SECURE_CONNECTION &&
!config.zeebeGrpcSettings.ZEEBE_INSECURE_CONNECTION
const certChainPath = config.CAMUNDA_CUSTOM_CERT_CHAIN_PATH
const privateKeyPath = config.CAMUNDA_CUSTOM_PRIVATE_KEY_PATH

Expand Down Expand Up @@ -278,16 +280,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 3fa2715

Please sign in to comment.