Skip to content

Commit

Permalink
Update writing-good-workers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jwulf authored Sep 2, 2024
1 parent 85cdf36 commit d85d227
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ These observations yield the following recommendations:

### Node.js client

Using the [Node.js client](https://github.com/camunda/camunda-platform-get-started/tree/master/nodejs), your worker code will look like this, assuming that you use Axios to do rest calls (but of course any other library is fine as well):
Using the [Node.js client](https://github.com/camunda/camunda-8-js-sdk), your worker code will look like this, assuming that you use Axios to do rest calls (but of course any other library is fine as well):

```js
zbc.createWorker({
taskType: "rest",
taskHandler: (job, _, worker) => {
taskHandler: (job) => {
console.log("Invoke REST call...");
axios
.get(PAYMENT_URL)
Expand All @@ -266,7 +266,7 @@ zbc.createWorker({

This is **reactive code**. And a really interesting observation is that reactive programming is so deep in the JavaScript language that it is impossible to write blocking code, even code that looks blocking is still [executed in a non-blocking fashion](https://github.com/berndruecker/camunda-cloud-clients-parallel-job-execution/blob/main/results/nodejs-blocking.log).

Node.js code scales pretty well and there is no specific thread pool defined or necessary. The Camunda 8 Node.js client library also [uses reactive programming internally](https://github.com/camunda-community-hub/zeebe-client-node-js/blob/master/src/zb/ZBWorker.ts#L28).
Node.js code scales pretty well and there is no specific thread pool defined or necessary. The Camunda 8 Node.js client library also [uses reactive programming internally](https://github.com/camunda/camunda-8-js-sdk/blob/main/src/zeebe/zb/ZBWorker.ts#L27).

This makes the recommendation very straight-forward:

Expand Down

0 comments on commit d85d227

Please sign in to comment.