Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Zeebe StreamActivatedJobs API #17

Closed
jwulf opened this issue Jan 31, 2024 · 11 comments
Closed

Support Zeebe StreamActivatedJobs API #17

jwulf opened this issue Jan 31, 2024 · 11 comments
Assignees

Comments

@jwulf
Copy link
Member

jwulf commented Jan 31, 2024

SDK Component

Zeebe

The Zeebe Gateway has a new RPC StreamJobs to open a long-lived stream that essentially "pushes" jobs to the worker.

This obviates polling loops.

camunda/camunda#14152

Environment variable to enable it:

ZEEBE_CLIENT_WORKER_STREAMENABLED

See also the documentation about the general concept, including how back pressure works and can be implemented for your custom client: https://stage.docs.camunda.io/docs/next/components/concepts/job-workers/#job-streaming

@aleksander-dytko
Copy link

Hi @jwulf, do I assume correctly that this is targeted for 8.5 release?

@jwulf
Copy link
Member Author

jwulf commented Mar 15, 2024

Hi @aleksander-dytko, it will probably soon come after the 8.5 release, asynchronously. There is a lot of work across the entire SDK for the 8.5 release.

@aleksander-dytko
Copy link

Thanks @jwulf. Do you know the rough timeline for this?
The customer raised a Feature Request here and I wanted to provide them with an update

@aleksander-dytko
Copy link

@jwulf @akeller do we know when this item will be delivered? I wanted to update the customer in the feature request

@jwulf
Copy link
Member Author

jwulf commented Apr 28, 2024

This feature is under development, I estimate that it will be available at the end of May. 

In the meantime, would you be able to share the current worker creation parameters? There may be some tuning that can be done with the existing long polling that could mitigate the resource exhaustion. 

Some ideas that occur to me are to extend the long poll period, and also to add a randomised offset to it so that different workers that are started at the same time do not all poll at once.

jwulf added a commit that referenced this issue May 14, 2024
@jwulf jwulf mentioned this issue May 14, 2024
@jwulf jwulf changed the title Support Zeebe StreamJobs API Support Zeebe StreamActivatedJobs API May 17, 2024
@jwulf
Copy link
Member Author

jwulf commented May 31, 2024

@aleksander-dytko an update on the status of this. This has been more challenging than I had anticipated. My revised time to deliver support for this feature in the JS SDK is the second week of June.

@jwulf
Copy link
Member Author

jwulf commented May 31, 2024

At the moment, this feature fails in CI against both SM and SaaS. Example: https://github.com/camunda/camunda-8-js-sdk/actions/runs/9313149620

On my local machine, it fails or succeeds with no discernable pattern.

I am using Wireshark to see if I can debug it at the network level.

The stream is opened, but sometimes nothing comes over it locally. On CI, nothing comes over it.

CI is running Ubuntu. Locally, I am running MacOS. I am installing Ubuntu locally to see what happens there.

@jwulf
Copy link
Member Author

jwulf commented Jun 5, 2024

@pepopowitz and I paired on this today. This appears to be an issue with the underlying JS gRPC library. We haven't been able to isolate the circumstances surrounding the failure to get it to stably reproduce.

Today, it worked for some time, and then started failing. I had thought that restarting the SM stack caused it to work for some time, but even that didn't work.

Here is a network packet capture from Wireshark for the failing call from the JS client:

Screenshot 2024-06-05 at 7 59 48 PM

The data packet that is being sent is an End Stream command.

Screenshot 2024-06-05 at 8 00 43 PM

With GRPC trace debugging turned on, this is what happens:

Screenshot 2024-06-05 at 8 01 23 PM

For some reason, the stream is terminated by the client immediately.

Contrast this with the network capture of the same request from the Java client (working, and in parallel to the JS client):

Screenshot 2024-06-05 at 7 59 29 PM

@jwulf
Copy link
Member Author

jwulf commented Jun 5, 2024

OK, I got it working outside the test suite. There seems to be some interaction in the way the test suite mechanics are wired up.

jwulf added a commit that referenced this issue Jun 5, 2024
* 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
@jwulf
Copy link
Member Author

jwulf commented Jun 5, 2024

In the test, it needs a two second delay after starting the stream before starting a process instance.

github-actions bot pushed a commit that referenced this issue Jun 5, 2024
## [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)
github-actions bot pushed a commit that referenced this issue Jun 5, 2024
## [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)
@jwulf jwulf closed this as completed in 5151eb0 Jun 5, 2024
github-actions bot pushed a commit that referenced this issue Jun 6, 2024
## [8.5.5](v8.5.4...v8.5.5) (2024-06-06)

### Features

* **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171)
* **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17)
github-actions bot pushed a commit that referenced this issue Jun 6, 2024
## [8.5.5](v8.5.4...v8.5.5) (2024-06-06)

### Features

* **zeebe:** add updateJobTimeout method ([#172](#172)) ([5eff624](5eff624)), closes [#171](#171)
* **zeebe:** support StreamActivatedJobs RPC ([#160](#160)) ([258296a](258296a)), closes [#17](#17)
@jwulf
Copy link
Member Author

jwulf commented Jun 6, 2024

@aleksander-dytko support for the streaming jobs API is available in the latest packages: 8.5.5 and 8.6.0.

Documentation:

https://camunda.github.io/camunda-8-js-sdk/classes/index.Zeebe.ZeebeGrpcClient.html#streamJobs

Here is a potential "gotcha" using this feature, documented in the README:

Job Streaming

The Zeebe gRPC API supports streaming available jobs, rather than polling for them.

The ZeebeGrpcClient method StreamJobs allows you to use this API.

Please note that only jobs that become available after the stream is opened are pushed to the client. For jobs that were already activatable before the method is called, you need to use a polling worker.

In this release, this is not handled for you. You must both poll and stream jobs to make sure that you get jobs that were available before your application started as well as jobs that become available after your application starts.

In a subsequent release, the ZeebeWorker will transparently handle this for you.

github-actions bot pushed a commit that referenced this issue Jun 7, 2024
## [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)
github-actions bot pushed a commit that referenced this issue Jun 7, 2024
## [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)
jwulf added a commit that referenced this issue Jun 10, 2024
* 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>
github-actions bot pushed a commit that referenced this issue Jun 12, 2024
## [8.6.2](v8.6.1...v8.6.2) (2024-06-12)

### Bug Fixes

* **zeebe:** security fix for grpc-js dependency update ([#180](#180)) ([f43d956](f43d956))

### Features

* **zeebe:** add deployResources method ([165862f](165862f)), closes [#173](#173)
* **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)
github-actions bot pushed a commit that referenced this issue Jun 12, 2024
## [8.6.2](v8.6.1...v8.6.2) (2024-06-12)

### Bug Fixes

* **zeebe:** security fix for grpc-js dependency update ([#180](#180)) ([f43d956](f43d956))

### Features

* **zeebe:** add deployResources method ([165862f](165862f)), closes [#173](#173)
* **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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants