Skip to content

Add experimental support for Event Groups (implicit and scope propagation) - #3198

Open
mjameswh wants to merge 1 commit into
mainfrom
event-groups-scopes
Open

mjameswh wants to merge 1 commit into
mainfrom
event-groups-scopes

Conversation

@mjameswh

@mjameswh mjameswh commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Add experimental support for implicit Event Groups and scope-based propagation. This follows #3197, which added direct assignment.

  • EventGroup.run attaches the group to commands issued inside the callback. Nested scopes compose, and the earliest label for an id wins.
  • Signal and update handlers run in an implicit group for the signal event or the update. That scope replaces any scope that was active when the handler was registered. Update validators are not wrapped.
  • Direct addEventGroups and the active scope are additive.
  • A workflow thread started with Async.function or Async.procedure keeps the scope that was active when it was started.

Promise continuations (thenApply, handle, thenCompose, exceptionally) do not capture the scope. They run on the thread that completes the promise, which is how CancellationScope and WorkflowThreadLocal already behave. Adopting a different behavior only for Event Groups would be inconsistent with other existing APIs. Extending context propagation on all APIs to also propagate to Promise continuations seems a desirable thing on the long term, but it is outside the scope of this PR, and would be a breaking behavior changes for existing workflows; we instead propose to delay this until the Java v2 SDK.

@mjameswh mjameswh changed the title Event groups scopes Add experimental support for Event Groups (implicit and scope propagation) Nov 10, 2026
Base automatically changed from event-groups-direct-only to main November 18, 2026 13:33
Commands issued inside EventGroup.run, and from signal and update handlers, carry the active groups. Promise continuations do not capture that scope.
@mjameswh
mjameswh force-pushed the event-groups-scopes branch from c018f14 to 4fb7280 Compare November 18, 2026 14:23
@mjameswh
mjameswh marked this pull request as ready for review November 18, 2026 14:56
@mjameswh
mjameswh requested a review from a team as a code owner November 18, 2026 14:56

This branch has not been deployed

No deployments
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.

1 participant