Skip to content

Add worker IDs to Java gRPC requests - #314

Merged
Tomer Rosenthal (torosent) merged 3 commits into
mainfrom
vabachu/workerid
Nov 13, 2026
Merged

Tomer Rosenthal (torosent) merged 3 commits into
mainfrom
vabachu/workerid

Conversation

@bachuv

@bachuv Varshitha Bachu (bachuv) commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Issue describing the changes in this PR

N/A - no linked issue.

Add a workerid gRPC header so the scheduler can associate requests with individual Java worker instances. Generate a hostname:pid:uuid ID once per worker instance and attach it through a worker-local channel wrapper before applying registered interceptors. This includes failure completions sent directly by the large-payload interceptor.

The ID remains stable across requests, token refresh, and reconnects. Workers sharing a channel or builder retain distinct IDs, and clients using the shared channel do not acquire a worker ID. PID discovery remains compatible with Java 8, with explicit errors when the PID or hostname cannot be determined.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Validation passed: .\gradlew.bat :client:test --tests '*OrchestratorChunkingTest' :azuremanaged:test --tests '*AudienceTransportTest' :azure-blob-payloads:test --tests '*LargePayloadInterceptorTest' -x :client:downloadProtoFiles --console=plain --quiet (68 tests, zero failures).

Coverage verifies the hostname/PID/UUID format, per-worker uniqueness with shared builders and channels, stable IDs across repeated requests and transport reconnects, unchanged client requests, invalid-PID handling, and worker IDs on failure completions after a payload download returns HTTP 404. The protobuf download task is excluded to preserve the checked-in definitions.

Local DTS end-to-end validation also passed against mcr.microsoft.com/dts/dts-emulator:latest and Azurite: 6 tests, zero failures or skips. This covers single activities, activity fan-out, sub-orchestrations, a 1.5 MB payload round trip, and scheduler redelivery after transient activity/orchestration upload failures. The actual DTS emulator logs recorded six distinct Java worker IDs in the expected hostname:pid:uuid format.

Exact integration command:

.\gradlew.bat :client:testClasses :azure-blob-payloads:testClasses :client:integrationTest --tests '*IntegrationTests.singleActivity' --tests '*IntegrationTests.activityFanOut' --tests '*IntegrationTests.subOrchestration' :azure-blob-payloads:integrationTest --tests '*LargePayloadIntegrationTest.roundTrip_largeInput_activityEchoesBack' --tests '*LargePayloadIntegrationTest.transientActivityUploadFailure_isRedeliveredAndCompletes' --tests '*LargePayloadIntegrationTest.transientOrchestrationUploadFailure_isRedeliveredAndCompletes' -x :client:build -x :azure-blob-payloads:build -x :client:downloadProtoFiles -PskipSigning --console=plain --quiet

@bachuv Varshitha Bachu (bachuv) changed the title Add Python-compatible worker IDs to Java gRPC requests Add worker IDs to Java gRPC requests Nov 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Failure completions after permanent payload-resolution errors bypass the header interceptor, omitting workerid and preventing the scheduler from attributing them to the worker.

1 open issue
What changed in this PR

Adds per-instance worker identity to Java worker gRPC requests so the scheduler can associate requests with individual workers without affecting clients sharing the same channel.

Changes:

  • Generates a stable hostname:pid:uuid ID and attaches it through the worker’s stub.
  • Adds tests for ID format, uniqueness, shared-channel isolation, and stability across token refresh and reconnects.
  • Documents the behavior in the changelog.
File Description
client/​src/​test/​java/​com/​microsoft/​durabletask/​OrchestratorChunkingTest.java Tests ID format, uniqueness, stability, and shared-channel isolation.
client/​src/​main/​java/​com/​microsoft/​durabletask/​DurableTaskGrpcWorker.java Generates worker IDs using Java 8-compatible APIs and attaches request metadata.
CHANGELOG.md Records the new worker identity behavior.
azuremanaged/​src/​test/​java/​com/​microsoft/​durabletask/​azuremanaged/​AudienceTransportTest.java Tests identity across token refresh and reconnects, plus invalid-PID handling.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the per-worker identity change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@bachuv
Varshitha Bachu (bachuv) marked this pull request as ready for review November 13, 2026 21:17
@bachuv
Varshitha Bachu (bachuv) requested a review from a team as a code owner November 13, 2026 21:17
@torosent
Tomer Rosenthal (torosent) merged commit 08d937f into main Nov 13, 2026
9 checks passed
@torosent
Tomer Rosenthal (torosent) deleted the vabachu/workerid branch November 13, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants