Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit 953a938

Browse files
authored
Merge pull request #207 from jwulf/0.26-grpc-proto
2 parents 08ca1af + 2fc150c commit 953a938

File tree

7 files changed

+66
-7
lines changed

7 files changed

+66
-7
lines changed

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ guide
44
src
55
design
66
docs
7+
.env
8+
*.env

DEVELOP.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,27 @@ To log from the Node engine itself (useful in tracking down grpc issues in grpc-
2525
```
2626
NODE_DEBUG=http2 GRPC_TRACE=channel,call_stream GRPC_VERBOSITY=DEBUG ZEEBE_NODE_LOGLEVEL=debug ZEEBE_NODE_PUREJS=true npm run test:integration
2727
```
28+
29+
To get extended stack traces:
30+
31+
```
32+
NODE_DEBUG=http2 GRPC_TRACE=channel,call_stream ZEEBE_NODE_PUREJS=true node --expose-internals --expose-gc node_modules/.bin/jest --runInBand --testPathIgnorePatterns disconnection --detectOpenHandles --verbose true Worker-Failure
33+
```
34+
35+
```
36+
valgrind node --expose-internals --expose-gc node_modules/.bin/jest --runInBand --testPathIgnorePatterns disconnection --detectOpenHandles Worker-Failure
37+
```
38+
39+
## Scaffold a Ubuntu machine for dev
40+
41+
sudo apt install -y build-essential
42+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
43+
source ~/.bashrc
44+
nvm install 14
45+
git clone https://github.com/camunda-community-hub/zeebe-client-node-js.git
46+
cd zeebe-client-node-js
47+
npm i
48+
49+
# Set Camunda Cloud env variables
50+
51+
ZEEBE_NODE_PUREJS=true node_modules/.bin/jest Worker-Failure

proto/zeebe.proto

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,16 @@ message WorkflowRequestObject {
151151
// using the file extension of the name field
152152
FILE = 0;
153153
BPMN = 1; // extension 'bpmn'
154-
YAML = 2; // extension 'yaml'
155-
}
154+
YAML = 2 [deprecated = true]; // extension 'yaml'; deprecated as of release 1.0
155+
}
156156

157157
// the resource basename, e.g. myProcess.bpmn
158158
string name = 1;
159159
// the resource type; if set to BPMN or YAML then the file extension
160160
// is ignored
161-
ResourceType type = 2;
161+
// As of release 1.0, YAML support was removed and BPMN is the only supported resource type.
162+
// The field was kept to not break clients.
163+
ResourceType type = 2 [deprecated = true];
162164
// the process definition as a UTF8-encoded string
163165
bytes definition = 3;
164166
}
@@ -225,6 +227,8 @@ message PublishMessageRequest {
225227
}
226228

227229
message PublishMessageResponse {
230+
// the unique ID of the message that was published
231+
int64 key = 1;
228232
}
229233

230234
message ResolveIncidentRequest {
@@ -247,6 +251,8 @@ message TopologyResponse {
247251
int32 partitionsCount = 3;
248252
// configured replication factor for this cluster
249253
int32 replicationFactor = 4;
254+
// gateway version
255+
string gatewayVersion = 5;
250256
}
251257

252258
message BrokerInfo {
@@ -265,12 +271,21 @@ message Partition {
265271
enum PartitionBrokerRole {
266272
LEADER = 0;
267273
FOLLOWER = 1;
274+
INACTIVE = 2;
275+
}
276+
277+
// Describes the current health of the partition
278+
enum PartitionBrokerHealth {
279+
HEALTHY = 0;
280+
UNHEALTHY = 1;
268281
}
269282

270283
// the unique ID of this partition
271284
int32 partitionId = 1;
272285
// the role of the broker for this partition
273286
PartitionBrokerRole role = 2;
287+
// the health of this partition
288+
PartitionBrokerHealth health = 3;
274289
}
275290

276291
message UpdateJobRetriesRequest {

src/lib/interfaces-grpc.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,25 @@ export interface CreateWorkflowInstanceWithResultResponse<Result> {
140140
variables: Result
141141
}
142142

143+
// Describes the Raft role of the broker for a given partition
143144
export enum PartitionBrokerRole {
144145
LEADER = 0,
145146
BROKER = 1,
147+
INACTIVE = 2,
148+
}
149+
150+
// Describes the current health of the partition
151+
export enum PartitionBrokerHealth {
152+
HEALTHY = 0,
153+
UNHEALTHY = 1,
146154
}
147155

148156
export interface Partition {
149157
partitionId: number
158+
// the role of the broker for this partition
150159
role: PartitionBrokerRole
160+
// the health of this partition
161+
health: PartitionBrokerHealth
151162
}
152163

153164
export interface BrokerInfo {
@@ -162,6 +173,7 @@ export interface TopologyResponse {
162173
readonly clusterSize: number
163174
readonly partitionsCount: number
164175
readonly replicationFactor: number
176+
readonly gatewayVersion: string
165177
}
166178

167179
export enum ResourceType {
@@ -209,6 +221,11 @@ export interface PublishMessageRequest<Variables = IInputVariables> {
209221
variables: Variables
210222
}
211223

224+
export interface PublishMessageResponse {
225+
// the unique ID of the message that was published
226+
key: number
227+
}
228+
212229
export interface PublishStartMessageRequest<Variables = IWorkflowVariables> {
213230
/** Should match the "Message Name" in a BPMN Message Catch */
214231
name: string

src/lib/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
DeployWorkflowResponse,
1212
FailJobRequest,
1313
PublishMessageRequest,
14+
PublishMessageResponse,
1415
SetVariablesRequest,
1516
ThrowErrorRequest,
1617
TopologyResponse,
@@ -334,7 +335,7 @@ export interface ZBGrpc extends GrpcClient {
334335
activateJobsStream: any
335336
publishMessageSync(
336337
publishMessageRequest: PublishMessageRequest
337-
): Promise<void>
338+
): Promise<PublishMessageResponse>
338339
throwErrorSync(throwErrorRequest: ThrowErrorRequest): Promise<void>
339340
topologySync(): Promise<TopologyResponse>
340341
updateJobRetriesSync(

src/zb/ZBClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ export class ZBClient extends TypedEmitter<typeof ConnectionStatusEvent> {
664664
*/
665665
public publishMessage<WorkflowVariables = ZB.IWorkflowVariables>(
666666
publishMessageRequest: Grpc.PublishMessageRequest<WorkflowVariables>
667-
): Promise<void> {
667+
): Promise<Grpc.PublishMessageResponse> {
668668
return this.executeOperation('publishMessage', () =>
669669
this.grpc.publishMessageSync(
670670
stringifyVariables(publishMessageRequest)
@@ -680,7 +680,7 @@ export class ZBClient extends TypedEmitter<typeof ConnectionStatusEvent> {
680680
publishStartMessageRequest: Grpc.PublishStartMessageRequest<
681681
WorkflowVariables
682682
>
683-
): Promise<void> {
683+
): Promise<Grpc.PublishMessageResponse> {
684684
/**
685685
* The hash of the correlationKey is used to determine the partition where this workflow will start.
686686
* So we assign a random uuid to balance workflow instances created via start message across partitions.

src/zb/ZBWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class ZBWorker<
2525
jobs: Array<ZB.Job<WorkerInputVariables, CustomHeaderShape>>
2626
) {
2727
// Call task handler for each new job
28-
jobs.forEach(job => this.handleJob(job))
28+
jobs.forEach(async job => this.handleJob(job))
2929
}
3030

3131
protected async handleJob(

0 commit comments

Comments
 (0)