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

I can pass a custom cancellationToken to the JobWorkerBuilder #519

Open
ionutcalin opened this issue May 22, 2023 · 0 comments
Open

I can pass a custom cancellationToken to the JobWorkerBuilder #519

ionutcalin opened this issue May 22, 2023 · 0 comments
Assignees

Comments

@ionutcalin
Copy link

Is your feature request related to a problem? Please describe.
Not being able to pass a cancellationToken to the job worker is restricting me to stop the worker upon request from some background service is stopped.

Describe the solution you'd like
Add an optional CancellationToken parameter to either ZeebeClient.NewWorker or JobWorkerBuilder.Open methods.
In JobWorker class add also CancellationToken parameter and if this one is not null use CancellationTokenSource.CreateLinkedTokenSource instead of new CancellationTokenSource like now.
Also take care about the difference on how the instance was created in the Dispose method of JobWorker so that we don't cancel/dispose twice the token/tokenSource.

Describe alternatives you've considered
The only solution I came up until now is to explicitly call the dispose on the job worker (without knowing the status of the encapuslated cancellationTokne). This is not a desired behavior as the job worker should automatically close when the "external" cancellationToken gets cancelled.

Additional context
None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants