Skip to content

Conversation

LennartKleymann
Copy link
Contributor

@LennartKleymann LennartKleymann commented Sep 23, 2025

closes #661

inspired by @dimasm61

  • Feature: gRPC job streaming (optional, off by default)
    - Opens a long‑lived stream; jobs are pushed without polling.
    - Backfilling threshold at 60% of MaxJobsActive to avoid over‑buffering.
  • Usage
    • Opt‑in streaming: call StreamEnabled(true) on the worker builder.
    • No breaking changes if streaming is not enabled.
  • Tests
    • Test gateway implements StreamActivatedJobs.
    • Added a unit test for streaming reception.

@LennartKleymann LennartKleymann force-pushed the 661-adding-job-streaming-support branch from 9f1c627 to 3afef6f Compare September 23, 2025 10:34
@nloding
Copy link
Collaborator

nloding commented Sep 26, 2025

thanks for the PRs Lennart! i will take a look at these next week!

@nloding nloding self-assigned this Sep 26, 2025
@nloding nloding added feature waiting-for-camunda Waiting for a review or feedback from a Camunda team member labels Sep 26, 2025
@ChrisKujawa ChrisKujawa requested a review from nloding September 29, 2025 14:08
Copy link
Collaborator

@nloding nloding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cloned and tested locally, everything works as advertised! great work!

Comment on lines +172 to +173
var jobCount = maxJobsActive - currentJobs;
activateJobsRequest.MaxJobsToActivate = jobCount;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I think this is to set the limit for the activation request we use during polling, right? I think the calculation is wrong here? Because we missed updating the currentJobs as we just received a job.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually looking at the code I think it is not necessary to change the request here or calculate this. I think we can remove this

var jobCount = maxJobsActive - currentJobs;
activateJobsRequest.MaxJobsToActivate = jobCount;

logger?.LogInformation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe debug is better?

if (!await stream.ResponseStream.MoveNext(cancellationToken))
{
logger?.LogDebug("Job stream MoveNext returned false; retrying shortly");
await Task.Delay(50, cancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a constant value... there are better options)
These delays may not be not correct for hiload.
In my code (local fork) I'v moved these values to the app settings. In this line I use 10ms, and on line 156 I use 100ms.

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

Labels

feature waiting-for-camunda Waiting for a review or feedback from a Camunda team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for job streaming

4 participants