-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Problem
When consuming workflow events via WatchStreamAsync() or NewEvents, there's no way to observe workflow completion or failure through the event stream. The framework emits WorkflowStartedEvent but has no corresponding WorkflowCompletedEvent. For errors, WorkflowErrorEvent exists but requires an Exception object .In scenarios where only an error message string is available (e.g., reading status from an external orchestrator), there's no suitable event type to use.
Additionally, RequestHaltEvent is internal, so implementations that need to surface halt information to stream consumers can't use it.
Proposal
-
Add
WorkflowCompletedEvent, a public event signaling that a workflow has completed, optionally carrying a result. This would be the natural counterpart toWorkflowStartedEvent. -
Add a string based failure event (or overload
WorkflowErrorEvent). Either a newWorkflowFailedEventthat accepts astring errorMessage, or an additional constructor onWorkflowErrorEventthat doesn't require anException. Not all failure scenarios have an exception object available. -
Consider making
RequestHaltEventpublic with anExecutorIdproperty, so consumers can observe which executor requested a halt. Currently it's internal and filtered out of event streams.