From 1d7003fe7160f3ffc0213a10e160272e45b9d8ce Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Mon, 1 Jul 2019 10:02:13 +0200 Subject: [PATCH 01/18] Make all response fields readonly --- src/lib/interfaces.ts | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/lib/interfaces.ts b/src/lib/interfaces.ts index ff5e826e..7271ceb5 100644 --- a/src/lib/interfaces.ts +++ b/src/lib/interfaces.ts @@ -52,42 +52,42 @@ export interface ActivateJobsRequest { export interface ActivatedJob { readonly key: string - type: string - jobHeaders: JobHeaders + readonly type: string + readonly jobHeaders: JobHeaders /** * JSON object as a string */ - customHeaders: string - worker: string - retries: number + readonly customHeaders: string + readonly worker: string + readonly retries: number /** * epoch milliseconds */ - deadline: string + readonly deadline: string /** * JSON object as a string */ - variables: string + readonly variables: string } export interface Job { readonly key: string - type: string - jobHeaders: JobHeaders - customHeaders: CustomHeaders - worker: string - retries: number + readonly type: string + readonly jobHeaders: JobHeaders + readonly customHeaders: CustomHeaders + readonly worker: string + readonly retries: number // epoch milliseconds - deadline: string - variables: Variables + readonly deadline: string + readonly variables: Variables } export interface JobHeaders { readonly workflowInstanceKey: string - bpmnProcessId: string - workflowDefinitionVersion: number + readonly bpmnProcessId: string + readonly workflowDefinitionVersion: number readonly workflowKey: string - elementId: string + readonly elementId: string readonly elementInstanceKey: string } @@ -126,8 +126,8 @@ export interface CreateWorkflowInstanceRequest { export interface CreateWorkflowInstanceResponse { readonly workflowKey: string - bpmnProcessId: string - version: number + readonly bpmnProcessId: string + readonly version: number readonly workflowInstanceKey: string } @@ -149,10 +149,10 @@ export interface BrokerInfo { } export interface TopologyResponse { - brokers: BrokerInfo[] - clusterSize: number - partitionsCount: number - replicationFactor: number + readonly brokers: BrokerInfo[] + readonly clusterSize: number + readonly partitionsCount: number + readonly replicationFactor: number } export enum ResourceType { @@ -169,23 +169,23 @@ export interface WorkflowRequestObject { } export interface WorkflowMetadata { - bpmnProcessId: string - version: number + readonly bpmnProcessId: string + readonly version: number readonly workflowKey: string - resourceName: string + readonly resourceName: string } export interface DeployWorkflowResponse { readonly key: string - workflows: WorkflowMetadata[] + readonly workflows: WorkflowMetadata[] } export interface DeployWorkflowRequest { - workflows: WorkflowRequestObject[] + readonly workflows: WorkflowRequestObject[] } export interface ListWorkflowResponse { - workflows: WorkflowMetadata[] + readonly workflows: WorkflowMetadata[] } export interface PublishMessageRequest { @@ -253,10 +253,10 @@ export interface GetWorkflowRequestWithBpmnProcessId { export interface GetWorkflowResponse { readonly workflowKey: string - version: number - bpmnProcessId: string - resourceName: string - bpmnXml: string + readonly version: number + readonly bpmnProcessId: string + readonly resourceName: string + readonly bpmnXml: string } export interface ZBClientOptions { From f4643c6beb7eea2b74676fe304a773b7c015d1dc Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Mon, 1 Jul 2019 17:52:40 +0200 Subject: [PATCH 02/18] Update for Zeebe 0.19 --- README.md | 4 +- package-lock.json | 2 +- package.json | 2 +- proto/zeebe.proto | 129 +++++------------- .../integration/ZBClient-integration.spec.ts | 85 ++---------- .../integration/ZBWorker-integration.spec.ts | 68 ++++++++- src/lib/interfaces.ts | 25 ++-- src/zb/ZBWorker.ts | 3 +- 8 files changed, 125 insertions(+), 193 deletions(-) diff --git a/README.md b/README.md index 1c751485..46bfaf42 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,12 @@ Docker-compose configurations for Zeebe are available at [https://github.com/zee ## Versioning -NPM Package version 1.x.x supports Zeebe 0.15/0.16. +NPM Package version 3.x.x supports Zeebe 0.19. NPM Package version 2.x.x supports Zeebe 0.18. +NPM Package version 1.x.x supports Zeebe 0.15/0.16. + ## Type difference from other Zeebe clients Protobuf fields of type `int64` are serialised as type string in the Node library. These fields are serialised as numbers (long) in the Go and Java client. See [grpc/#7229](https://github.com/grpc/grpc/issues/7229) for why the Node library serialises them as string. The Workflow instance key, and other fields that are of type long in other client libraries, are type string in this library. Fields of type `int32` are serialised as type number in the Node library. diff --git a/package-lock.json b/package-lock.json index 85664b23..65f0d09a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "zeebe-node", - "version": "2.4.0", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index defbb0d9..a7d294e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zeebe-node", - "version": "2.4.0", + "version": "3.0.0", "description": "A Node.js client library for the Zeebe Microservices Orchestration Engine.", "keywords": [ "zeebe", diff --git a/proto/zeebe.proto b/proto/zeebe.proto index f2c1f9d7..a2ab0cf8 100644 --- a/proto/zeebe.proto +++ b/proto/zeebe.proto @@ -5,11 +5,14 @@ option java_multiple_files = false; option java_package = "io.zeebe.gateway.protocol"; option go_package = "pb"; +// For a more complete documentation, refer to Zeebe documentation at: +// https://docs.zeebe.io/grpc/reference.html + message ActivateJobsRequest { - // the job type, as defined in the BPMN process (e.g. ) + // the job type, as defined in the BPMN process (e.g. ) string type = 1; - // the name of the worker activating the jobs, mostly used for logging purposes + // the name of the worker activating the jobs, mostly used for logging purposes string worker = 2; // a job returned after this call will not be activated by another call until the // timeout has been reached @@ -22,46 +25,40 @@ message ActivateJobsRequest { } message ActivateJobsResponse { - // list of activated jobs + // list of activated jobs repeated ActivatedJob jobs = 1; } message ActivatedJob { - // the key, a unique identifier for the job + // the key, a unique identifier for the job int64 key = 1; // the type of the job (should match what was requested) string type = 2; - // a set of headers tying the job to a workflow instance/task instance - JobHeaders jobHeaders = 3; - // a set of custom headers defined during modelling; returned as a serialized - // JSON document - // json object as string - string customHeaders = 4; - // the name of the worker which activated this job - string worker = 5; - // the amount of retries left to this job (should always be positive) - int32 retries = 6; - // when the job can be activated again, sent as a UNIX epoch timestamp - int64 deadline = 7; - // JSON document, computed at activation time, consisting of all visible variables to - // the task scope - string variables = 8; -} - -message JobHeaders { // the job's workflow instance key - int64 workflowInstanceKey = 1; + int64 workflowInstanceKey = 3; // the bpmn process ID of the job workflow definition - string bpmnProcessId = 2; + string bpmnProcessId = 4; // the version of the job workflow definition - int32 workflowDefinitionVersion = 3; + int32 workflowDefinitionVersion = 5; // the key of the job workflow definition - int64 workflowKey = 4; + int64 workflowKey = 6; // the associated task element ID - string elementId = 5; + string elementId = 7; // the unique key identifying the associated task, unique within the scope of the // workflow instance - int64 elementInstanceKey = 6; + int64 elementInstanceKey = 8; + // a set of custom headers defined during modelling; returned as a serialized + // JSON document + string customHeaders = 9; + // the name of the worker which activated this job + string worker = 10; + // the amount of retries left to this job (should always be positive) + int32 retries = 11; + // when the job can be activated again, sent as a UNIX epoch timestamp + int64 deadline = 12; + // JSON document, computed at activation time, consisting of all visible variables to + // the task scope + string variables = 13; } message CancelWorkflowInstanceRequest { @@ -76,8 +73,7 @@ message CancelWorkflowInstanceResponse { message CompleteJobRequest { // the unique job identifier, as obtained from ActivateJobsResponse int64 jobKey = 1; - // a JSON document representing the variables in the current task scope - /* payload has to be a valid json object as string */ + // a JSON document representing the variables in the current task scope string variables = 2; } @@ -110,7 +106,7 @@ message CreateWorkflowInstanceResponse { int32 version = 3; // the unique identifier of the created workflow instance; to be used wherever a request // needs a workflow instance key (e.g. CancelWorkflowInstanceRequest) - int64 workflowInstanceKey = 5; + int64 workflowInstanceKey = 4; } message DeployWorkflowRequest { @@ -120,7 +116,8 @@ message DeployWorkflowRequest { message WorkflowRequestObject { enum ResourceType { - // FILE type means the gateway will try to detect the resource type using the file extension of the name + // FILE type means the gateway will try to detect the resource type + // using the file extension of the name field FILE = 0; BPMN = 1; // extension 'bpmn' YAML = 2; // extension 'yaml' @@ -163,49 +160,12 @@ message FailJobRequest { // an optional message describing why the job failed // this is particularly useful if a job runs out of retries and an incident is raised, // as it this message can help explain why an incident was raised - string errorMessage = 3; } message FailJobResponse { } -/* either workflow key or bpmn process id and version has to be specified*/ -message GetWorkflowRequest { - // the unique key identifying the workflow definition (e.g. returned from a workflow in - // the DeployWorkflowResponse message) - int64 workflowKey = 1; - // the version of the process; set to -1 to use the latest version - int32 version = 2; - // the BPMN process ID of the workflow definition - string bpmnProcessId = 3; -} - -message GetWorkflowResponse { - // the unique key identifying the workflow definition (e.g. returned from a workflow in - // the DeployWorkflowResponse message) - int64 workflowKey = 1; - // the version of the process - int32 version = 2; - // the BPMN process ID of the workflow definition - string bpmnProcessId = 3; - // the name of the resource used to deployed the workflow - string resourceName = 4; - // a BPMN XML representation of the workflow - string bpmnXml = 5; -} - -message ListWorkflowsRequest { - // optional filter: if specified, only the workflows with this given process ID will be - // returned - string bpmnProcessId = 1; -} - -message ListWorkflowsResponse { - // a list of deployed workflows matching the request criteria (if any) - repeated WorkflowMetadata workflows = 1; -} - message PublishMessageRequest { // the name of the message string name = 1; @@ -267,7 +227,7 @@ message Partition { // the unique ID of this partition int32 partitionId = 1; // the role of the broker for this partition - PartitionBrokerRole role = 3; + PartitionBrokerRole role = 2; } message UpdateJobRetriesRequest { @@ -280,11 +240,10 @@ message UpdateJobRetriesRequest { message UpdateJobRetriesResponse { } - message SetVariablesRequest { // the unique identifier of a particular element; can be the workflow instance key (as // obtained during instance creation), or a given element, such as a service task (see - // elementInstanceKey on the JobHeaders message) + // elementInstanceKey on the job message) int64 elementInstanceKey = 1; // a JSON serialized document describing variables as key value pairs; the root of the document // must be an object @@ -398,30 +357,6 @@ service Gateway { rpc FailJob (FailJobRequest) returns (FailJobResponse) { } - /* - Fetches the workflow definition either by workflow key, or BPMN process ID and version. - At least one of workflowKey or bpmnProcessId must be specified. - - Errors: - NOT_FOUND: - - no workflow with the given key exists (if workflowKey was given) - - no workflow with the given process ID exists (if bpmnProcessId was given but version was -1) - - no workflow with the given process ID and version exists (if both bpmnProcessId and version were given) - */ - rpc GetWorkflow (GetWorkflowRequest) returns (GetWorkflowResponse) { - } - - /* - Lists all workflows matching the request criteria currently deployed in the cluster. - - Errors: - NOT_FOUND: - - no workflows have been deployed yet (if no bpmnProcessId was given) - - no workflow with the given process ID exists (if bpmnProcessId was given) - */ - rpc ListWorkflows (ListWorkflowsRequest) returns (ListWorkflowsResponse) { - } - /* Publishes a single message. Messages are published to specific partitions computed from their correlation keys. diff --git a/src/__tests__/integration/ZBClient-integration.spec.ts b/src/__tests__/integration/ZBClient-integration.spec.ts index 6d7f879c..b47e080f 100644 --- a/src/__tests__/integration/ZBClient-integration.spec.ts +++ b/src/__tests__/integration/ZBClient-integration.spec.ts @@ -4,7 +4,7 @@ jest.unmock('node-grpc-client') process.env.ZB_NODE_LOG_LEVEL = process.env.ZB_NODE_LOG_LEVEL || 'NONE' -describe('ZBClient.deployWorkflow()', () => { +describe('ZBClient', () => { let zbc: ZBClient beforeEach(async () => { @@ -26,12 +26,10 @@ describe('ZBClient.deployWorkflow()', () => { expect(res.workflows[0].bpmnProcessId).toBe('hello-world') }) - // Note: this will change in Zeebe 0.19! - // See: https://github.com/zeebe-io/zeebe/issues/1159 - it('By default, it deploys a single workflow when that workflow is already deployed', async () => { + it('Does not redeploy a workflow when that workflow is already deployed', async () => { const res = await zbc.deployWorkflow('./test/hello-world.bpmn') expect(res.workflows.length).toBe(1) - expect(res.workflows[0].version > 1).toBe(true) + expect(res.workflows[0].version > 1).toBe(false) }) it('Can create a worker', async () => { @@ -48,7 +46,6 @@ describe('ZBClient.deployWorkflow()', () => { it('Can start a workflow', async () => { const res = await zbc.deployWorkflow('./test/hello-world.bpmn') expect(res.workflows.length).toBe(1) - expect(res.workflows[0].version > 1).toBe(true) const workflowInstance = await zbc.createWorkflowInstance( 'hello-world', @@ -58,36 +55,6 @@ describe('ZBClient.deployWorkflow()', () => { expect(workflowInstance.workflowInstanceKey).toBeTruthy() }) - it('Can service a task', async done => { - const res = await zbc.deployWorkflow('./test/hello-world.bpmn') - expect(res.workflows.length).toBe(1) - expect(res.workflows[0].version > 1).toBe(true) - - const wf = await zbc.createWorkflowInstance('hello-world', {}) - zbc.createWorker('test', 'console-log', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe( - wf.workflowInstanceKey - ) - complete(job.variables) - done() - }) - }) - - it('Can service a task with complete.success', async done => { - const res = await zbc.deployWorkflow('./test/hello-world.bpmn') - expect(res.workflows.length).toBe(1) - expect(res.workflows[0].version > 1).toBe(true) - - const wf = await zbc.createWorkflowInstance('hello-world', {}) - zbc.createWorker('test', 'console-log', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe( - wf.workflowInstanceKey - ) - complete.success(job.variables) - done() - }) - }) - it('Can start a workflow with a message', async done => { const deploy = await zbc.deployWorkflow( './src/__tests__/testdata/msg-start.bpmn' @@ -148,12 +115,12 @@ describe('ZBClient.deployWorkflow()', () => { expect(wfi).toBeTruthy() await zbc.createWorker('test2', 'wait', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) complete(job) }) await zbc.createWorker('test2', 'pathA', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) expect(job.variables.conditionVariable).toBe(true) complete(job) done() @@ -180,50 +147,18 @@ describe('ZBClient.deployWorkflow()', () => { }) await zbc.createWorker('test2', 'wait', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) complete(job) }) await zbc.createWorker('test2', 'pathB', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) expect(job.variables.conditionVariable).toBe(false) complete(job.variables) done() }) }) - it('Can update workflow variables with complete.success()', async done => { - const res = await zbc.deployWorkflow('./test/conditional-pathway.bpmn') - expect(res.workflows.length).toBe(1) - expect(res.workflows[0].bpmnProcessId).toBe('condition-test') - - const wf = await zbc.createWorkflowInstance('condition-test', { - conditionVariable: true, - }) - const wfi = wf.workflowInstanceKey - expect(wfi).toBeTruthy() - - await zbc.setVariables({ - elementInstanceKey: wfi, - local: false, - variables: { - conditionVariable: false, - }, - }) - - await zbc.createWorker('test2', 'wait', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) - complete.success(job) - }) - - await zbc.createWorker('test2', 'pathB', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) - expect(job.variables.conditionVariable).toBe(false) - complete.success(job.variables) - done() - }) - }) - it('Causes a retry with complete.failure()', async done => { let attempts = 0 const res = await zbc.deployWorkflow('./test/conditional-pathway.bpmn') @@ -245,7 +180,7 @@ describe('ZBClient.deployWorkflow()', () => { }) await zbc.createWorker('test2', 'wait', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) attempts++ // Succeed on the third attempt if (attempts === 3) { @@ -279,12 +214,12 @@ describe('ZBClient.deployWorkflow()', () => { }) await zbc.createWorker('test2', 'wait', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) complete.success(job) }) await zbc.createWorker('test2', 'pathB', async (job, complete) => { - expect(job.jobHeaders.workflowInstanceKey).toBe(wfi) + expect(job.workflowInstanceKey).toBe(wfi) expect(job.variables.conditionVariable).toBe(false) complete.failure('Raise an incident in Operate', 0) // Manually verify that an incident has been raised diff --git a/src/__tests__/integration/ZBWorker-integration.spec.ts b/src/__tests__/integration/ZBWorker-integration.spec.ts index 50636542..548d3545 100644 --- a/src/__tests__/integration/ZBWorker-integration.spec.ts +++ b/src/__tests__/integration/ZBWorker-integration.spec.ts @@ -4,9 +4,39 @@ jest.unmock('node-grpc-client') process.env.ZB_NODE_LOG_LEVEL = process.env.ZB_NODE_LOG_LEVEL || 'NONE' describe('ZBWorker', () => { - it('Does not fail a workflow when the handler throws, by default', async done => { - const zbc = new ZBClient('0.0.0.0:26500') + let zbc: ZBClient + + beforeEach(async () => { + zbc = new ZBClient('0.0.0.0:26500') + }) + + afterEach(async () => { + await zbc.close() // Makes sure we don't forget to close connection + }) + + it('Can service a task', async done => { + const res = await zbc.deployWorkflow('./test/hello-world.bpmn') + expect(res.workflows.length).toBe(1) + const wf = await zbc.createWorkflowInstance('hello-world', {}) + zbc.createWorker('test', 'console-log', async (job, complete) => { + expect(job.workflowInstanceKey).toBe(wf.workflowInstanceKey) + complete(job.variables) + done() + }) + }) + + it('Can service a task with complete.success', async done => { + const res = await zbc.deployWorkflow('./test/hello-world.bpmn') + expect(res.workflows.length).toBe(1) + const wf = await zbc.createWorkflowInstance('hello-world', {}) + zbc.createWorker('test', 'console-log', async (job, complete) => { + expect(job.workflowInstanceKey).toBe(wf.workflowInstanceKey) + complete.success(job.variables) + done() + }) + }) + it('Does not fail a workflow when the handler throws, by default', async done => { const res = await zbc.deployWorkflow('./test/hello-world.bpmn') expect(res.workflows.length).toBe(1) expect(res.workflows[0].bpmnProcessId).toBe('hello-world') @@ -37,8 +67,6 @@ describe('ZBWorker', () => { }) }) it('Fails a workflow when the handler throws and options.failWorkflowOnException is set', async done => { - const zbc = new ZBClient('0.0.0.0:26500') - const res = await zbc.deployWorkflow('./test/hello-world.bpmn') expect(res.workflows.length).toBe(1) expect(res.workflows[0].bpmnProcessId).toBe('hello-world') @@ -74,4 +102,36 @@ describe('ZBWorker', () => { } ) }) + + it('Can update workflow variables with complete.success()', async done => { + const res = await zbc.deployWorkflow('./test/conditional-pathway.bpmn') + expect(res.workflows.length).toBe(1) + expect(res.workflows[0].bpmnProcessId).toBe('condition-test') + + const wf = await zbc.createWorkflowInstance('condition-test', { + conditionVariable: true, + }) + const wfi = wf.workflowInstanceKey + expect(wfi).toBeTruthy() + + await zbc.setVariables({ + elementInstanceKey: wfi, + local: false, + variables: { + conditionVariable: false, + }, + }) + + await zbc.createWorker('test2', 'wait', async (job, complete) => { + expect(job.workflowInstanceKey).toBe(wfi) + complete.success(job) + }) + + await zbc.createWorker('test2', 'pathB', async (job, complete) => { + expect(job.workflowInstanceKey).toBe(wfi) + expect(job.variables.conditionVariable).toBe(false) + complete.success(job.variables) + done() + }) + }) }) diff --git a/src/lib/interfaces.ts b/src/lib/interfaces.ts index 7271ceb5..1ae72cd4 100644 --- a/src/lib/interfaces.ts +++ b/src/lib/interfaces.ts @@ -53,7 +53,12 @@ export interface ActivateJobsRequest { export interface ActivatedJob { readonly key: string readonly type: string - readonly jobHeaders: JobHeaders + readonly workflowInstanceKey: string + readonly bpmnProcessId: string + readonly workflowDefinitionVersion: number + readonly workflowKey: string + readonly elementId: string + readonly elementInstanceKey: string /** * JSON object as a string */ @@ -73,22 +78,18 @@ export interface ActivatedJob { export interface Job { readonly key: string readonly type: string - readonly jobHeaders: JobHeaders - readonly customHeaders: CustomHeaders - readonly worker: string - readonly retries: number - // epoch milliseconds - readonly deadline: string - readonly variables: Variables -} - -export interface JobHeaders { readonly workflowInstanceKey: string readonly bpmnProcessId: string readonly workflowDefinitionVersion: number readonly workflowKey: string readonly elementId: string readonly elementInstanceKey: string + readonly customHeaders: CustomHeaders + readonly worker: string + readonly retries: number + // epoch milliseconds + readonly deadline: string + readonly variables: Variables } export interface ZBWorkerOptions { @@ -229,7 +230,7 @@ export interface SetVariablesRequest { /* The unique identifier of a particular element; can be the workflow instance key (as obtained during instance creation), or a given element, such as a service task (see - elementInstanceKey on the JobHeaders message) + elementInstanceKey on the Job message) */ readonly elementInstanceKey: string variables: Partial diff --git a/src/zb/ZBWorker.ts b/src/zb/ZBWorker.ts index 44505dc2..43d1cfbb 100644 --- a/src/zb/ZBWorker.ts +++ b/src/zb/ZBWorker.ts @@ -300,8 +300,7 @@ export class ZBWorker< }) if (this.cancelWorkflowOnException) { - const workflowInstanceKey = - job.jobHeaders.workflowInstanceKey + const workflowInstanceKey = job.workflowInstanceKey this.logger.debug( `Cancelling workflow ${workflowInstanceKey}` ) From 5f9adccd0562bc8feec575fbb68cf7c18ab6ecce Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Thu, 4 Jul 2019 14:40:27 +0200 Subject: [PATCH 03/18] add .bpmn extension if needed --- src/zb/ZBClient.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index ee24d2cf..d95697ed 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -138,9 +138,20 @@ export class ZBClient { ): Promise { const workflows = Array.isArray(workflow) ? workflow : [workflow] + const readFile = (filename: string) => { + if (fs.existsSync(filename)) { + return fs.readFileSync(filename) + } + const name = `${filename}.bpmn` + if (fs.existsSync(name)) { + return fs.readFileSync(name) + } + throw new Error(`${filename} not found.`) + } + const workFlowRequests: ZB.WorkflowRequestObject[] = workflows.map( wf => ({ - definition: fs.readFileSync(wf), + definition: readFile(wf), name: path.basename(wf), type: 1, }) From fa43ccae877f11ebf39b4745b9873afd319aa405 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Thu, 4 Jul 2019 14:41:48 +0200 Subject: [PATCH 04/18] Clear timeout on complete.failure. Fixes #53 --- src/zb/ZBWorker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zb/ZBWorker.ts b/src/zb/ZBWorker.ts index 43d1cfbb..da71896f 100644 --- a/src/zb/ZBWorker.ts +++ b/src/zb/ZBWorker.ts @@ -277,6 +277,10 @@ export class ZBWorker< jobKey: job.key, retries, }) + this.logger.debug( + `Failed job ${job.key} - ${errorMessage}` + ) + clearInterval(timeoutCancel) } return shadowWorkerCallback })() From e344c69a28220826682c57df77e40e654ee8788a Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Thu, 4 Jul 2019 20:53:55 +0200 Subject: [PATCH 05/18] parse gatewayAddress to remove protocol --- src/zb/ZBClient.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index d95697ed..0bd4f205 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -3,6 +3,7 @@ import * as fs from 'fs' import GRPCClient from 'node-grpc-client' import * as path from 'path' import promiseRetry from 'promise-retry' +import { parse } from 'url' import { v4 as uuid } from 'uuid' import { BpmnParser, stringifyVariables } from '../lib' import * as ZB from '../lib/interfaces' @@ -11,6 +12,8 @@ import { KeyedObject } from '../lib/interfaces' import { Utils } from '../lib/utils' import { ZBWorker } from './ZBWorker' +const DEFAULT_GATEWAY_PORT = '26500' + const idColors = [ chalk.yellow, chalk.green, @@ -43,17 +46,20 @@ export class ZBClient { options.loglevel || 'INFO' - if (gatewayAddress.indexOf(':') === -1) { - gatewayAddress += ':26500' + if (!gatewayAddress.includes('://')) { + gatewayAddress = `grpc://${gatewayAddress}` } + const url = parse(gatewayAddress) + url.port = url.port || DEFAULT_GATEWAY_PORT + url.hostname = url.hostname || url.path - this.gatewayAddress = gatewayAddress + this.gatewayAddress = `${url.hostname}:${url.port}` this.gRPCClient = new GRPCClient( path.join(__dirname, '../../proto/zeebe.proto'), 'gateway_protocol', 'Gateway', - gatewayAddress + this.gatewayAddress ) this.retry = options.retry !== false From 289007d84b372d800f3c7d7a32c83c6c74b28527 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Thu, 4 Jul 2019 20:55:07 +0200 Subject: [PATCH 06/18] add protocol if missing --- src/zb/ZBClient.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index 0bd4f205..b4fc0444 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -46,7 +46,8 @@ export class ZBClient { options.loglevel || 'INFO' - if (!gatewayAddress.includes('://')) { + const includesProtocol = gatewayAddress.includes('://') + if (!includesProtocol) { gatewayAddress = `grpc://${gatewayAddress}` } const url = parse(gatewayAddress) From f1d1ef01ceb9aa7f809597d7848dc567ff9c44ca Mon Sep 17 00:00:00 2001 From: Collin Date: Tue, 9 Jul 2019 13:23:54 +0200 Subject: [PATCH 07/18] Reimplemented grpc-client, added tls option --- package-lock.json | 274 +++++++----------- package.json | 3 +- src/__tests__/ZBClient-unmocked.spec.ts | 16 +- .../integration/ZBWorker-integration.spec.ts | 1 - src/__tests__/integration/test.spec.ts | 1 - src/global.d.ts | 1 - src/lib/GRPCClient.ts | 68 +++++ src/lib/interfaces.ts | 1 + src/zb/ZBClient.ts | 6 +- 9 files changed, 189 insertions(+), 182 deletions(-) delete mode 100644 src/global.d.ts create mode 100644 src/lib/GRPCClient.ts diff --git a/package-lock.json b/package-lock.json index 85664b23..b3e39212 100644 --- a/package-lock.json +++ b/package-lock.json @@ -187,21 +187,12 @@ } }, "@grpc/proto-loader": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.3.0.tgz", - "integrity": "sha512-9b8S/V+3W4Gv7G/JKSZ48zApgyYbfIR7mAC9XNnaSWme3zj57MIESu0ELzm9j5oxNIpFG8DgO00iJMIUZ5luqw==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.1.tgz", + "integrity": "sha512-3y0FhacYAwWvyXshH18eDkUI40wT/uGio7MAegzY8lO5+wVsc19+1A7T0pPptae4kl7bdITL+0cHpnAPmryBjQ==", "requires": { - "@types/lodash": "^4.14.104", - "@types/node": "^9.4.6", - "lodash": "^4.17.5", + "lodash.camelcase": "^4.3.0", "protobufjs": "^6.8.6" - }, - "dependencies": { - "@types/node": { - "version": "9.6.49", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.49.tgz", - "integrity": "sha512-YY0Okyn4QXC4ugJI+Kng5iWjK8A6eIHiQVaGIhJkyn0YL6Iqo0E0tBC8BuhvYcBK87vykBijM5FtMnCqaa5anA==" - } } }, "@jest/console": { @@ -532,6 +523,15 @@ "@babel/types": "^7.3.0" } }, + "@types/bytebuffer": { + "version": "5.0.40", + "resolved": "https://registry.npmjs.org/@types/bytebuffer/-/bytebuffer-5.0.40.tgz", + "integrity": "sha512-h48dyzZrPMz25K6Q4+NCwWaxwXany2FhQg/ErOcdZS1ZpsaDnDMZg8JYLMTGz7uvXKrcKGJUZJlZObyfgdaN9g==", + "requires": { + "@types/long": "*", + "@types/node": "*" + } + }, "@types/debug": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-0.0.31.tgz", @@ -622,7 +622,8 @@ "@types/lodash": { "version": "4.14.134", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.134.tgz", - "integrity": "sha512-2/O0khFUCFeDlbi7sZ7ZFRCcT812fAeOLm7Ev4KbwASkZ575TDrDcY7YyaoHdTOzKcNbfiwLYZqPmoC4wadrsw==" + "integrity": "sha512-2/O0khFUCFeDlbi7sZ7ZFRCcT812fAeOLm7Ev4KbwASkZ575TDrDcY7YyaoHdTOzKcNbfiwLYZqPmoC4wadrsw==", + "dev": true }, "@types/long": { "version": "4.0.0", @@ -654,6 +655,15 @@ "@types/retry": "*" } }, + "@types/protobufjs": { + "version": "5.0.31", + "resolved": "https://registry.npmjs.org/@types/protobufjs/-/protobufjs-5.0.31.tgz", + "integrity": "sha1-g5hTCYM+NVuYNrIb9QDisRQnTNA=", + "requires": { + "@types/bytebuffer": "*", + "@types/node": "*" + } + }, "@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", @@ -3349,10 +3359,11 @@ "dev": true }, "grpc": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.21.1.tgz", - "integrity": "sha512-PFsZQazf62nP05a0xm23mlImMuw5oVlqF/0zakmsdqJgvbABe+d6VThY2PfhqJmWEL/FhQ6QNYsxS5EAM6++7g==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.22.0.tgz", + "integrity": "sha512-kQ83nrX2SuiDLHnTI57WZjVqVizD4HYXhAG0aAzq8xAYYylNGXV5r75WIKW8mYZwHMPERBkCGm68ECY/PUlNdA==", "requires": { + "@types/protobufjs": "^5.0.31", "lodash.camelcase": "^4.3.0", "lodash.clone": "^4.5.0", "nan": "^2.13.2", @@ -3362,23 +3373,19 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": false, - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + "bundled": true }, "ansi-regex": { "version": "2.1.1", - "resolved": false, - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + "bundled": true }, "aproba": { "version": "1.2.0", - "resolved": false, - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + "bundled": true }, "are-we-there-yet": { "version": "1.1.5", - "resolved": false, - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "bundled": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -3386,13 +3393,11 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": false, - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "bundled": true }, "brace-expansion": { "version": "1.1.11", - "resolved": false, - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "bundled": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3400,61 +3405,50 @@ }, "chownr": { "version": "1.1.1", - "resolved": false, - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" + "bundled": true }, "code-point-at": { "version": "1.1.0", - "resolved": false, - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + "bundled": true }, "concat-map": { "version": "0.0.1", - "resolved": false, - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "resolved": false, - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + "bundled": true }, "core-util-is": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "bundled": true }, "deep-extend": { "version": "0.6.0", - "resolved": false, - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + "bundled": true }, "delegates": { "version": "1.0.0", - "resolved": false, - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + "bundled": true }, "detect-libc": { "version": "1.0.3", - "resolved": false, - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + "bundled": true }, "fs-minipass": { - "version": "1.2.5", - "resolved": false, - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", + "version": "1.2.6", + "bundled": true, "requires": { "minipass": "^2.2.1" } }, "fs.realpath": { "version": "1.0.0", - "resolved": false, - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "bundled": true }, "gauge": { "version": "2.7.4", - "resolved": false, - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "bundled": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -3468,29 +3462,25 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": false, - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + "bundled": true }, "iconv-lite": { "version": "0.4.23", - "resolved": false, - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "bundled": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { "version": "3.0.1", - "resolved": false, - "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "bundled": true, "requires": { "minimatch": "^3.0.4" } }, "inflight": { "version": "1.0.6", - "resolved": false, - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "bundled": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3498,44 +3488,37 @@ }, "inherits": { "version": "2.0.3", - "resolved": false, - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "bundled": true }, "ini": { "version": "1.3.5", - "resolved": false, - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "bundled": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "bundled": true, "requires": { "number-is-nan": "^1.0.0" } }, "isarray": { "version": "1.0.0", - "resolved": false, - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "bundled": true }, "minimatch": { "version": "3.0.4", - "resolved": false, - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "bundled": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "1.2.0", - "resolved": false, - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + "bundled": true }, "minipass": { "version": "2.3.5", - "resolved": false, - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "bundled": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3543,56 +3526,49 @@ }, "minizlib": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "bundled": true, "requires": { "minipass": "^2.2.1" } }, "mkdirp": { "version": "0.5.1", - "resolved": false, - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "bundled": true, "requires": { "minimist": "0.0.8" }, "dependencies": { "minimist": { "version": "0.0.8", - "resolved": false, - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "bundled": true } } }, "needle": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.1.tgz", - "integrity": "sha512-CaLXV3W8Vnbps8ZANqDGz7j4x7Yj1LW4TWF/TQuDfj7Cfx4nAPTvw98qgTevtto1oHDrh3pQkaODbqupXlsWTg==", + "version": "2.4.0", + "bundled": true, "requires": { - "debug": "^4.1.0", + "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "3.2.6", + "bundled": true, "requires": { "ms": "^2.1.1" } }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "version": "2.1.2", + "bundled": true } } }, "node-pre-gyp": { "version": "0.13.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz", - "integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==", + "bundled": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", @@ -3608,8 +3584,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": false, - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "bundled": true, "requires": { "abbrev": "1", "osenv": "^0.1.4" @@ -3617,13 +3592,11 @@ }, "npm-bundled": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", - "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==" + "bundled": true }, "npm-packlist": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", - "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", + "bundled": true, "requires": { "ignore-walk": "^3.0.1", "npm-bundled": "^1.0.1" @@ -3631,8 +3604,7 @@ }, "npmlog": { "version": "4.1.2", - "resolved": false, - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "bundled": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -3642,36 +3614,30 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": false, - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + "bundled": true }, "object-assign": { "version": "4.1.1", - "resolved": false, - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "bundled": true }, "once": { "version": "1.4.0", - "resolved": false, - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "bundled": true, "requires": { "wrappy": "1" } }, "os-homedir": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + "bundled": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + "bundled": true }, "osenv": { "version": "0.1.5", - "resolved": false, - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "bundled": true, "requires": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" @@ -3679,13 +3645,11 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": false, - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "bundled": true }, "process-nextick-args": { - "version": "2.0.0", - "resolved": false, - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "version": "2.0.1", + "bundled": true }, "protobufjs": { "version": "5.0.3", @@ -3700,8 +3664,7 @@ }, "rc": { "version": "1.2.8", - "resolved": false, - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "bundled": true, "requires": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -3711,8 +3674,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": false, - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "bundled": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3725,16 +3687,14 @@ }, "rimraf": { "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "bundled": true, "requires": { "glob": "^7.1.3" }, "dependencies": { "glob": { "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "bundled": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3748,38 +3708,31 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": false, - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "bundled": true }, "safer-buffer": { "version": "2.1.2", - "resolved": false, - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "bundled": true }, "sax": { "version": "1.2.4", - "resolved": false, - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "bundled": true }, "semver": { "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + "bundled": true }, "set-blocking": { "version": "2.0.0", - "resolved": false, - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "bundled": true }, "signal-exit": { - "version": "3.0.2", - "resolved": false, - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + "version": "3.0.1", + "bundled": true }, "string-width": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3788,61 +3741,53 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": false, - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "bundled": true, "requires": { "safe-buffer": "~5.1.0" } }, "strip-ansi": { "version": "3.0.1", - "resolved": false, - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "bundled": true, "requires": { "ansi-regex": "^2.0.0" } }, "strip-json-comments": { "version": "2.0.1", - "resolved": false, - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + "bundled": true }, "tar": { - "version": "4.4.8", - "resolved": false, - "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", + "version": "4.4.10", + "bundled": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" + "yallist": "^3.0.3" } }, "util-deprecate": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "bundled": true }, "wide-align": { "version": "1.1.3", - "resolved": false, - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "bundled": true, "requires": { "string-width": "^1.0.2 || 2" } }, "wrappy": { "version": "1.0.2", - "resolved": false, - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "bundled": true }, "yallist": { "version": "3.0.3", - "resolved": false, - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" + "bundled": true } } }, @@ -6416,15 +6361,6 @@ "integrity": "sha1-esGavSl+Caf3KnFUXZUbUX5N3iw=", "dev": true }, - "node-grpc-client": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/node-grpc-client/-/node-grpc-client-1.3.0.tgz", - "integrity": "sha512-CNB4I6xmDkdkttCYIBRkSiFZ8bvwqNagE8FW6LbhEZVR0/67/qjdVfdFWwOaQ4QMOxWNHd/8ImtOymbFR+2BbQ==", - "requires": { - "@grpc/proto-loader": "^0.3.0", - "grpc": "^1.14.1" - } - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/package.json b/package.json index defbb0d9..957aef0e 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,13 @@ ] }, "dependencies": { + "@grpc/proto-loader": "^0.5.1", "@types/promise-retry": "^1.1.3", "chalk": "^2.4.2", "console-stamp": "^0.2.7", "debug": "^4.1.1", "fast-xml-parser": "^3.12.12", - "node-grpc-client": "^1.3.0", + "grpc": "^1.22.0", "promise-retry": "^1.1.1", "uuid": "^3.3.2" }, diff --git a/src/__tests__/ZBClient-unmocked.spec.ts b/src/__tests__/ZBClient-unmocked.spec.ts index 7761f440..56e86cb9 100644 --- a/src/__tests__/ZBClient-unmocked.spec.ts +++ b/src/__tests__/ZBClient-unmocked.spec.ts @@ -1,15 +1,17 @@ import { ZBClient } from '..' -jest.unmock('node-grpc-client') describe('ZBClient constructor', () => { it('throws an exception when there is no broker and retry is false', async () => { const zbc = new ZBClient('localhoster', { retry: false }) - expect.assertions(1) - try { - await zbc.deployWorkflow('./test/hello-world.bpmn') - } catch (e) { - expect(e.message.indexOf('14 UNAVAILABLE:')).toEqual(0) - } + setTimeout(async () => { + expect.assertions(1) + try { + await zbc.deployWorkflow('./test/hello-world.bpmn') + expect(false).toBeFalsy() + } catch (e) { + expect(e.message.indexOf('14 UNAVAILABLE:')).toEqual(0) + } + }, 10000) }) it('does not throw when there is no broker, by default', async done => { const zbc = new ZBClient('localhoster') diff --git a/src/__tests__/integration/ZBWorker-integration.spec.ts b/src/__tests__/integration/ZBWorker-integration.spec.ts index 50636542..59b9a94d 100644 --- a/src/__tests__/integration/ZBWorker-integration.spec.ts +++ b/src/__tests__/integration/ZBWorker-integration.spec.ts @@ -1,5 +1,4 @@ import { ZBClient } from '../..' -jest.unmock('node-grpc-client') process.env.ZB_NODE_LOG_LEVEL = process.env.ZB_NODE_LOG_LEVEL || 'NONE' diff --git a/src/__tests__/integration/test.spec.ts b/src/__tests__/integration/test.spec.ts index 2b9e41b7..c8bc6fd0 100644 --- a/src/__tests__/integration/test.spec.ts +++ b/src/__tests__/integration/test.spec.ts @@ -1,5 +1,4 @@ import { ZBClient } from '../../index' -jest.unmock('node-grpc-client') describe('ZBClient', () => { it('deploys a workflow', async () => { diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index c9ae3ef5..00000000 --- a/src/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'node-grpc-client'; diff --git a/src/lib/GRPCClient.ts b/src/lib/GRPCClient.ts new file mode 100644 index 00000000..28657172 --- /dev/null +++ b/src/lib/GRPCClient.ts @@ -0,0 +1,68 @@ +import { loadSync, PackageDefinition } from '@grpc/proto-loader' +import { Client, credentials, loadPackageDefinition } from 'grpc' + +export class GRPCClient { + private packageDefinition: PackageDefinition + private client: Client + private listNameMethods: any[] + + constructor( + protoPath: string, + packageName: string, + service: string, + host: string, + options = {} as any, + tls: boolean = false + ) { + this.packageDefinition = loadSync(protoPath, { + defaults: options.default === undefined ? true : options.default, + enums: options.enums === undefined ? String : options.enums, + keepCase: options.keepCase === undefined ? true : options.keepCase, + longs: options.longs === undefined ? String : options.longs, + oneofs: options.default === undefined ? true : options.default, + }) + + const proto = loadPackageDefinition(this.packageDefinition)[packageName] + const listMethods = this.packageDefinition[`${packageName}.${service}`] + const channelCredentials = tls + ? credentials.createSsl() + : credentials.createInsecure() + this.client = new proto[service](host, channelCredentials) + this.listNameMethods = [] + + for (const key in listMethods) { + if (key) { + const methodName = listMethods[key].originalName + this.listNameMethods.push(methodName) + + this[`${methodName}Async`] = (data, fnAnswer) => { + this.client[methodName](data, fnAnswer) + } + + this[`${methodName}Stream`] = data => { + return this.client[methodName](data) + } + + this[`${methodName}Sync`] = data => { + const client = this.client + return new Promise((resolve, reject) => { + client[methodName](data, (err, dat) => { + if (err) { + return reject(err) + } + resolve(dat) + }) + }) + } + } + } + } + + public runService(fnName, data, fnAnswer) { + this.client[fnName](data, fnAnswer) + } + + public listMethods() { + return this.listNameMethods + } +} diff --git a/src/lib/interfaces.ts b/src/lib/interfaces.ts index ff5e826e..6d77800a 100644 --- a/src/lib/interfaces.ts +++ b/src/lib/interfaces.ts @@ -265,4 +265,5 @@ export interface ZBClientOptions { retry?: boolean maxRetries?: number maxRetryTimeout?: number + tls?: boolean } diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index ee24d2cf..f64006b1 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -1,10 +1,10 @@ import chalk from 'chalk' import * as fs from 'fs' -import GRPCClient from 'node-grpc-client' import * as path from 'path' import promiseRetry from 'promise-retry' import { v4 as uuid } from 'uuid' import { BpmnParser, stringifyVariables } from '../lib' +import { GRPCClient } from '../lib/GRPCClient' import * as ZB from '../lib/interfaces' // tslint:disable-next-line: no-duplicate-imports import { KeyedObject } from '../lib/interfaces' @@ -53,7 +53,9 @@ export class ZBClient { path.join(__dirname, '../../proto/zeebe.proto'), 'gateway_protocol', 'Gateway', - gatewayAddress + gatewayAddress, + {}, + options.tls ) this.retry = options.retry !== false From 3e44f7ce4cfe712aec66c9698f63e32601b1c2c5 Mon Sep 17 00:00:00 2001 From: Collin Date: Wed, 10 Jul 2019 09:34:57 +0200 Subject: [PATCH 08/18] Implemented suggestions from the PR --- README.md | 10 ++++++++++ src/__tests__/ZBClient-unmocked.spec.ts | 1 - .../integration/ZBClient-integration.spec.ts | 1 - src/lib/GRPCClient.ts | 12 ++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1c751485..2d0dbe37 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,16 @@ const zbc = new ZB.ZBClient(gatewayAddress, { Retry is provided by [promise-retry](https://www.npmjs.com/package/promise-retry), and the back-off strategy is simple ^2. +### TLS + +In case you need to connect to a secured endpoint, you can enable TLS. + +```typescript +const zbc = new ZB.ZBClient(gatewayAddress, { + tls: true, +}) +``` + ### Create a Task Worker ```javascript diff --git a/src/__tests__/ZBClient-unmocked.spec.ts b/src/__tests__/ZBClient-unmocked.spec.ts index 56e86cb9..d3d367d9 100644 --- a/src/__tests__/ZBClient-unmocked.spec.ts +++ b/src/__tests__/ZBClient-unmocked.spec.ts @@ -7,7 +7,6 @@ describe('ZBClient constructor', () => { expect.assertions(1) try { await zbc.deployWorkflow('./test/hello-world.bpmn') - expect(false).toBeFalsy() } catch (e) { expect(e.message.indexOf('14 UNAVAILABLE:')).toEqual(0) } diff --git a/src/__tests__/integration/ZBClient-integration.spec.ts b/src/__tests__/integration/ZBClient-integration.spec.ts index 6d7f879c..60d966a2 100644 --- a/src/__tests__/integration/ZBClient-integration.spec.ts +++ b/src/__tests__/integration/ZBClient-integration.spec.ts @@ -1,6 +1,5 @@ import { v4 as uuid } from 'uuid' import { ZBClient } from '../..' -jest.unmock('node-grpc-client') process.env.ZB_NODE_LOG_LEVEL = process.env.ZB_NODE_LOG_LEVEL || 'NONE' diff --git a/src/lib/GRPCClient.ts b/src/lib/GRPCClient.ts index 28657172..7f0fa47b 100644 --- a/src/lib/GRPCClient.ts +++ b/src/lib/GRPCClient.ts @@ -1,25 +1,25 @@ -import { loadSync, PackageDefinition } from '@grpc/proto-loader' +import { loadSync, Options, PackageDefinition } from '@grpc/proto-loader' import { Client, credentials, loadPackageDefinition } from 'grpc' export class GRPCClient { private packageDefinition: PackageDefinition private client: Client - private listNameMethods: any[] + private listNameMethods: string[] constructor( protoPath: string, packageName: string, service: string, host: string, - options = {} as any, + options: Options = {}, tls: boolean = false ) { this.packageDefinition = loadSync(protoPath, { - defaults: options.default === undefined ? true : options.default, + defaults: options.defaults === undefined ? true : options.defaults, enums: options.enums === undefined ? String : options.enums, keepCase: options.keepCase === undefined ? true : options.keepCase, longs: options.longs === undefined ? String : options.longs, - oneofs: options.default === undefined ? true : options.default, + oneofs: options.oneofs === undefined ? true : options.oneofs, }) const proto = loadPackageDefinition(this.packageDefinition)[packageName] @@ -31,7 +31,7 @@ export class GRPCClient { this.listNameMethods = [] for (const key in listMethods) { - if (key) { + if (listMethods[key]) { const methodName = listMethods[key].originalName this.listNameMethods.push(methodName) From 4a6b126939a505f76656d5dd57a751a75ba50de4 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 01:23:17 +1000 Subject: [PATCH 09/18] Test against Zeebe 0.19.0 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ce70ffd..21fb890e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: test: docker: - image: circleci/node:11.10.1 - - image: camunda/zeebe:0.18.0 + - image: camunda/zeebe:0.19.0 working_directory: ~/zeebe-client-node-js steps: - checkout From 7cb6a160d68f4dd31273f1e9d672e64ab8c3bbe8 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 01:57:53 +1000 Subject: [PATCH 10/18] Use readiness endpoint --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 21fb890e..75aee919 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,7 +51,10 @@ jobs: command: | for i in `seq 1 10`; do - nc -z localhost 26500 && echo success && exit 0 + curl localhost:9600/ready + if [ $? == 52 ]; then + echo success && exit 0 + fi echo -n . sleep 1 done From 7cb187bee39d77dda389a21481627ce674e8b5f5 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 02:04:48 +1000 Subject: [PATCH 11/18] Use correct gateway Address --- src/zb/ZBClient.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index 5186ab30..a3a4dccc 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -56,11 +56,13 @@ export class ZBClient { this.gatewayAddress = `${url.hostname}:${url.port}` + console.log('this.gatewayAddress', this.gatewayAddress) // tslint:disable-line + this.gRPCClient = new GRPCClient( path.join(__dirname, '../../proto/zeebe.proto'), 'gateway_protocol', 'Gateway', - gatewayAddress, + this.gatewayAddress, {}, options.tls ) From 83586eba141a4346365c5e1f8692cd62c8a9eee9 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 02:07:25 +1000 Subject: [PATCH 12/18] Remove console.log --- src/zb/ZBClient.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/zb/ZBClient.ts b/src/zb/ZBClient.ts index a3a4dccc..b3d86415 100644 --- a/src/zb/ZBClient.ts +++ b/src/zb/ZBClient.ts @@ -56,8 +56,6 @@ export class ZBClient { this.gatewayAddress = `${url.hostname}:${url.port}` - console.log('this.gatewayAddress', this.gatewayAddress) // tslint:disable-line - this.gRPCClient = new GRPCClient( path.join(__dirname, '../../proto/zeebe.proto'), 'gateway_protocol', From 638dc163bf18547c417d1b06bf72a1b7710614ef Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 02:38:41 +1000 Subject: [PATCH 13/18] Test against SNAPSHOT --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 75aee919..a57c27ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: test: docker: - image: circleci/node:11.10.1 - - image: camunda/zeebe:0.19.0 + - image: camunda/zeebe:SNAPSHOT working_directory: ~/zeebe-client-node-js steps: - checkout From 4afc73c4e3e60db549caae25528d822c55794a89 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 03:15:34 +1000 Subject: [PATCH 14/18] Passes all tests against Zeebe dev branch --- proto/zeebe.proto | 1 + src/__tests__/ZBClient-unmocked.spec.ts | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/proto/zeebe.proto b/proto/zeebe.proto index a2ab0cf8..b7c296b4 100644 --- a/proto/zeebe.proto +++ b/proto/zeebe.proto @@ -1,3 +1,4 @@ +// From: https://github.com/zeebe-io/zeebe/blob/develop/gateway-protocol/src/main/proto/gateway.proto syntax = 'proto3'; package gateway_protocol; diff --git a/src/__tests__/ZBClient-unmocked.spec.ts b/src/__tests__/ZBClient-unmocked.spec.ts index d3d367d9..9fbf4223 100644 --- a/src/__tests__/ZBClient-unmocked.spec.ts +++ b/src/__tests__/ZBClient-unmocked.spec.ts @@ -3,14 +3,12 @@ import { ZBClient } from '..' describe('ZBClient constructor', () => { it('throws an exception when there is no broker and retry is false', async () => { const zbc = new ZBClient('localhoster', { retry: false }) - setTimeout(async () => { - expect.assertions(1) - try { - await zbc.deployWorkflow('./test/hello-world.bpmn') - } catch (e) { - expect(e.message.indexOf('14 UNAVAILABLE:')).toEqual(0) - } - }, 10000) + expect.assertions(1) + try { + await zbc.deployWorkflow('./test/hello-world.bpmn') + } catch (e) { + expect(e.message.indexOf('14 UNAVAILABLE:')).toEqual(0) + } }) it('does not throw when there is no broker, by default', async done => { const zbc = new ZBClient('localhoster') From c7b85dccf2b8c57b63a0e7303839583634878674 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 03:19:27 +1000 Subject: [PATCH 15/18] Test against 0.2.0 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a57c27ec..b37ad884 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: test: docker: - image: circleci/node:11.10.1 - - image: camunda/zeebe:SNAPSHOT + - image: camunda/zeebe:0.2.0 working_directory: ~/zeebe-client-node-js steps: - checkout From 6200b1876e02480f121f3aa17853bded9f62fde2 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 10:55:31 +1000 Subject: [PATCH 16/18] Use custom docker image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b37ad884..3a300bea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: test: docker: - image: circleci/node:11.10.1 - - image: camunda/zeebe:0.2.0 + - image: sitapati/zeebe:0.20.0 working_directory: ~/zeebe-client-node-js steps: - checkout From 31fbadd3c4f32e5e92effb7c324b5d245b0f5a4c Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 13:17:24 +1000 Subject: [PATCH 17/18] Use readiness endpoint with nc --- .circleci/config.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a300bea..fd3ce6c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,10 +51,7 @@ jobs: command: | for i in `seq 1 10`; do - curl localhost:9600/ready - if [ $? == 52 ]; then - echo success && exit 0 - fi + nc -z localhost 9600 && echo success && exit 0 echo -n . sleep 1 done From 9ed691dcdafccf1808c28d79ab8d70a69dd71fe7 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Fri, 12 Jul 2019 13:45:32 +1000 Subject: [PATCH 18/18] Use nc to await Zeebe --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fd3ce6c0..b8891f55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,7 +51,7 @@ jobs: command: | for i in `seq 1 10`; do - nc -z localhost 9600 && echo success && exit 0 + nc -z localhost 26500 && echo success && exit 0 echo -n . sleep 1 done