Repository navigation
Add experimental support for Event Groups (direct assignment) - #3197
Conversation
The test server now stores the event group markers and user metadata of each command on the event that command produces, instead of only on the start events. Actions that act on an existing entity receive the command as a CommandRequest, so they no longer read those fields from the entity's data.
8c5814d to
e9dca3e
Compare
addEventGroups now accepts a list as well as varargs. The signal and cancel options on ExternalWorkflowStub and ChildWorkflowStub move to signalWithOptions and cancelWithOptions, so a null argument keeps its existing meaning.
|
One other thing I noticed is a static event group looks possible to create for example through a static option: static final EventGroup GROUP = Workflow.newEventGroup(
"orders", EventGroupOptions.newBuilder().setLabel("Orders").build());
static final TimerOptions TIMER_OPTIONS =
TimerOptions.newBuilder().addEventGroups(GROUP).build();
@WorkflowMethod
public void run() {
Workflow.sleep(Duration.ofSeconds(1), TIMER_OPTIONS);
}Each execution of run() uses the same group, but the groups encoding could be specific to the workflow right?. |
Right. I had previously considered and dismissed the idea of sharing Event Groups as a blatant misuse of the Workflow API. I mean, you wouldn't expect that a Cancellation Scope or Promise that you created through But I have to admit that using this indirectly like you did, i.e. as part of some So I simply removed marker caching. Its benefit was marginal anyway. |
A group may be declared statically and shared by workflows whose data converters differ, for instance through a context-aware payload codec, so a cached marker could carry a label encoded for another workflow.
fdf5d9d to
c64dd95
Compare
…ent-groups-direct-only # Conflicts: # temporal-sdk/src/main/java/io/temporal/internal/statemachines/WorkflowStateMachines.java # temporal-sdk/src/test/java/io/temporal/internal/statemachines/MutableSideEffectStateMachineTest.java
# Conflicts: # temporal-sdk/src/main/java/io/temporal/internal/statemachines/ExecuteLocalActivityParameters.java # temporal-sdk/src/main/java/io/temporal/internal/sync/SyncWorkflowContext.java # temporal-sdk/src/test/java/io/temporal/internal/replay/OutdatedDirectQueryReplayWorkflowRunTaskHandlerTest.java # temporal-sdk/src/test/java/io/temporal/internal/replay/ReplayWorkflowRunTaskHandlerTaskHandlerTests.java # temporal-sdk/src/test/java/io/temporal/internal/statemachines/LocalActivityStateMachineTest.java
What was changed
Add experimental support for Event Groups. Only direct assignment of explicit Event Groups is supported in this PR.
Event Groups is a new form of Workflow-level metadata that allows for improved visibility into a Workflow execution's history by grouping logically related Events together based on user-defined or system-inferred criteria.
Workflow.newEventGroup(id).Workflow.newEventGroup(id, EventGroupOptions.newBuilder().setLabel("label").build()); the label is codec-encoded payload.addEventGroupson various command options).Implicit Event Groups and Scope-based propagation is not covered by this PR.
Review notes