-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(zeebe): add updateJobTimeout method (#172) * feat(zeebe): add updateJobTimeout method fixes #171 * feat(zeebe): support StreamActivatedJobs RPC (#160) * feat(zeebe): support StreamActivatedJobs RPC fixes #17 * test(zeebe): add inputVariableDto to test * refactor(zeebe): incorporate DTO decoding * test(zeebe): fix StreamJobs test * docs(zeebe): document StreamJobs * feat(zeebe): enable compression * test(zeebe): fix StreamJobs test * test(zeebe): add delay in StreamJobs test * test(zeebe): close Zeebe cllent in StreamJob test * fix(zeebe): cleanup Job Streams on close * feat(zeebe): return close method from StreamJobs * chore(release): 8.5.5-alpha.1 [skip ci] ## [8.5.5-alpha.1](v8.5.4...v8.5.5-alpha.1) (2024-06-05) ### Features * **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171) * **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17) * chore(release): 8.5.5-alpha.1 [skip ci] ## [8.5.5-alpha.1](v8.5.4...v8.5.5-alpha.1) (2024-06-05) ### Features * **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171) * **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17) * feat(zeebe): add multi-tenant support to workers (#175) adds tenantIds: string[] to stream and polling worker config fixes #171 * chore(release): 8.6.1-alpha.1 [skip ci] ## [8.6.1-alpha.1](v8.6.0...v8.6.1-alpha.1) (2024-06-07) ### Features * **zeebe:** add multi-tenant support to workers ([#175](#175)) ([28450a5](28450a5)), closes [#171](#171) * **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171) * **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17) * chore(release): 8.6.1-alpha.1 [skip ci] ## [8.6.1-alpha.1](v8.6.0...v8.6.1-alpha.1) (2024-06-07) ### Features * **zeebe:** add multi-tenant support to workers ([#175](#175)) ([28450a5](28450a5)), closes [#171](#171) * **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171) * **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17) * ci(repo): add dispatch workflow to actions --------- Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
- Loading branch information
1 parent
a52af19
commit 05b3ecb
Showing
13 changed files
with
276 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: Pull Request tests | ||
|
||
on: [pull_request] | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: Publish a new version | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/__tests__/testdata/multi-tenant-stream-worker-test.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1o5c8zw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.5.0"> | ||
<bpmn:process id="multi-tenant-stream-worker-test" name="Multi-tenant Stream Worker Test" isExecutable="true"> | ||
<bpmn:startEvent id="StartEvent_1" name="Start multi-tenancy worker test"> | ||
<bpmn:outgoing>Flow_0r8p543</bpmn:outgoing> | ||
</bpmn:startEvent> | ||
<bpmn:sequenceFlow id="Flow_0r8p543" sourceRef="StartEvent_1" targetRef="Activity_1an5aay" /> | ||
<bpmn:endEvent id="Event_1hylnf3" name="Multi-tenancy worker test complete"> | ||
<bpmn:incoming>Flow_08wm3o9</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="Flow_08wm3o9" sourceRef="Activity_1an5aay" targetRef="Event_1hylnf3" /> | ||
<bpmn:serviceTask id="Activity_1an5aay" name="multi-tenant-stream-work"> | ||
<bpmn:extensionElements> | ||
<zeebe:taskDefinition type="multi-tenant-stream-work" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_0r8p543</bpmn:incoming> | ||
<bpmn:outgoing>Flow_08wm3o9</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
</bpmn:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="multi-tenant-stream-worker-test"> | ||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> | ||
<dc:Bounds x="179" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="160" y="142" width="75" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_1hylnf3_di" bpmnElement="Event_1hylnf3"> | ||
<dc:Bounds x="432" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="417" y="142" width="66" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_0cx6d07_di" bpmnElement="Activity_1an5aay"> | ||
<dc:Bounds x="270" y="77" width="100" height="80" /> | ||
<bpmndi:BPMNLabel /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0r8p543_di" bpmnElement="Flow_0r8p543"> | ||
<di:waypoint x="215" y="117" /> | ||
<di:waypoint x="270" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_08wm3o9_di" bpmnElement="Flow_08wm3o9"> | ||
<di:waypoint x="370" y="117" /> | ||
<di:waypoint x="432" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1o5c8zw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.5.0"> | ||
<bpmn:process id="multi-tenant-worker-test" name="Multi-tenant Worker Test" isExecutable="true"> | ||
<bpmn:startEvent id="StartEvent_1" name="Start multi-tenancy worker test"> | ||
<bpmn:outgoing>Flow_0r8p543</bpmn:outgoing> | ||
</bpmn:startEvent> | ||
<bpmn:sequenceFlow id="Flow_0r8p543" sourceRef="StartEvent_1" targetRef="Activity_1an5aay" /> | ||
<bpmn:endEvent id="Event_1hylnf3" name="Multi-tenancy worker test complete"> | ||
<bpmn:incoming>Flow_08wm3o9</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="Flow_08wm3o9" sourceRef="Activity_1an5aay" targetRef="Event_1hylnf3" /> | ||
<bpmn:serviceTask id="Activity_1an5aay" name="multi-tenant-work"> | ||
<bpmn:extensionElements> | ||
<zeebe:taskDefinition type="multi-tenant-work" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_0r8p543</bpmn:incoming> | ||
<bpmn:outgoing>Flow_08wm3o9</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
</bpmn:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="multi-tenant-worker-test"> | ||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> | ||
<dc:Bounds x="179" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="160" y="142" width="75" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_1hylnf3_di" bpmnElement="Event_1hylnf3"> | ||
<dc:Bounds x="432" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="417" y="142" width="66" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_0cx6d07_di" bpmnElement="Activity_1an5aay"> | ||
<dc:Bounds x="270" y="77" width="100" height="80" /> | ||
<bpmndi:BPMNLabel /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0r8p543_di" bpmnElement="Flow_0r8p543"> | ||
<di:waypoint x="215" y="117" /> | ||
<di:waypoint x="270" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_08wm3o9_di" bpmnElement="Flow_08wm3o9"> | ||
<di:waypoint x="370" y="117" /> | ||
<di:waypoint x="432" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
110 changes: 110 additions & 0 deletions
110
src/__tests__/zeebe/multitenancy/multitenant-worker-mt.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { restoreZeebeLogging, suppressZeebeLogging } from '../../../lib' | ||
import { ZeebeGrpcClient } from '../../../zeebe/index' | ||
|
||
jest.setTimeout(10000) | ||
|
||
beforeAll(() => { | ||
suppressZeebeLogging() | ||
}) | ||
|
||
afterAll(() => { | ||
restoreZeebeLogging() | ||
}) | ||
|
||
test('A worker can be multi-tenant', async () => { | ||
const client = new ZeebeGrpcClient() | ||
|
||
await client.deployResource({ | ||
processFilename: './src/__tests__/testdata/multi-tenant-worker-test.bpmn', | ||
tenantId: '<default>', | ||
}) | ||
|
||
await client.deployResource({ | ||
processFilename: './src/__tests__/testdata/multi-tenant-worker-test.bpmn', | ||
tenantId: 'green', | ||
}) | ||
|
||
await client.createProcessInstance({ | ||
bpmnProcessId: 'multi-tenant-worker-test', | ||
variables: { foo: 'bar' }, | ||
tenantId: '<default>', | ||
}) | ||
|
||
await client.createProcessInstance({ | ||
bpmnProcessId: 'multi-tenant-worker-test', | ||
variables: { foo: 'bar' }, | ||
tenantId: 'green', | ||
}) | ||
|
||
let greenTenant = false, | ||
defaultTenant = false | ||
await new Promise((resolve) => | ||
client.createWorker({ | ||
taskHandler: (job) => { | ||
greenTenant = greenTenant || job.tenantId === 'green' | ||
defaultTenant = defaultTenant || job.tenantId === '<default>' | ||
if (greenTenant && defaultTenant) { | ||
resolve(null) | ||
} | ||
return job.complete() | ||
}, | ||
taskType: 'multi-tenant-work', | ||
tenantIds: ['<default>', 'green'], | ||
}) | ||
) | ||
|
||
await client.close() | ||
}) | ||
|
||
test('A stream worker can be multi-tenant', async () => { | ||
const client = new ZeebeGrpcClient() | ||
|
||
await client.deployResource({ | ||
processFilename: | ||
'./src/__tests__/testdata/multi-tenant-stream-worker-test.bpmn', | ||
tenantId: '<default>', | ||
}) | ||
|
||
await client.deployResource({ | ||
processFilename: | ||
'./src/__tests__/testdata/multi-tenant-stream-worker-test.bpmn', | ||
tenantId: 'green', | ||
}) | ||
|
||
let greenTenant = false, | ||
defaultTenant = false | ||
// eslint-disable-next-line no-async-promise-executor | ||
await new Promise(async (resolve) => { | ||
client.streamJobs({ | ||
taskHandler: async (job) => { | ||
greenTenant = greenTenant || job.tenantId === 'green' | ||
defaultTenant = defaultTenant || job.tenantId === '<default>' | ||
const res = await job.complete() | ||
if (greenTenant && defaultTenant) { | ||
resolve(null) | ||
} | ||
return res | ||
}, | ||
type: 'multi-tenant-stream-work', | ||
tenantIds: ['<default>', 'green'], | ||
worker: 'stream-worker', | ||
timeout: 2000, | ||
}) | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 2000)) | ||
|
||
await client.createProcessInstance({ | ||
bpmnProcessId: 'multi-tenant-stream-worker-test', | ||
variables: { foo: 'bar' }, | ||
tenantId: '<default>', | ||
}) | ||
|
||
await client.createProcessInstance({ | ||
bpmnProcessId: 'multi-tenant-stream-worker-test', | ||
variables: { foo: 'bar' }, | ||
tenantId: 'green', | ||
}) | ||
}) | ||
|
||
await client.close() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.