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

Commit

Permalink
Fixed the code example in README.md for publishing a start message. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahibbutt authored Apr 8, 2024
1 parent ec412b2 commit 7969ce1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ const result = await zbc.createProcessInstanceWithResult({
You can publish a message to the Zeebe broker that will be correlated with a running process instance:
```javascript
const { ZBClient, Duration } = require('zeebe-node')
const { ZBClient, Duration } = require('zeebe-node');
const uuid = require('uuid');

const zbc = new ZBClient()

Expand Down Expand Up @@ -1333,15 +1334,17 @@ In this case, the correlation key is optional, and all Message Start events that
You can use the `publishStartMessage()` method to publish a message with no correlation key (it will be set to a random uuid in the background):
```javascript
const { ZBClient, Duration } = require('zeebe-node')
const { ZBClient, Duration } = require('zeebe-node');
const uuid = require('uuid');

const zbc = new ZB.ZBClient('localhost:26500')
const zbc = new ZBClient('localhost:26500');
zbc.publishStartMessage({
messageId: uuid.v4(),
name: 'message-name',
variables: { initialProcessVariable: 'here' },
timeToLive: Duration.seconds.of(10), // seconds
})
messageId: uuid.v4(),
name: 'message-name',
variables: { initialProcessVariable: 'here' },
timeToLive: Duration.seconds.of(10), // seconds
});

```
Both normal messages and start messages can be published idempotently by setting both the `messageId` and the `correlationKey`. They will only ever be correlated once. See: [A message can be published idempotent](https://github.com/zeebe-io/zeebe/issues/1012).
Expand Down

0 comments on commit 7969ce1

Please sign in to comment.