sdk-java currently models workflow/task lifecycle events as a set of concrete classes (WorkflowStartedEvent, TaskCompletedEvent, etc., in io.serverlessworkflow.impl.lifecycle) plus a separate class of CloudEvent-type string constants (LifecycleEvents). There's no single enum identifying "what kind of event is this" that consumers can switch/filter on without an instanceof chain or comparing against LifecycleEvents strings.
Downstream, at least two consumers in quarkiverse/quarkus-flow independently reimplement this same taxonomy as local enums:
opentelemetry/runtime: WorkflowEventType + TaskEventType, each pairing a constant with its LifecycleEvents id and a fromEvent(WorkflowEvent) classifier via instanceof checks.
testing (quarkus-flow-testing): EventType, a flat 16-value enum covering both workflow- and task-level events, used to classify recorded events in test assertions.
Both are hand-written mirrors of the same 16 event kinds sdk-java already defines via its event classes/LifecycleEvents constants.
Request: Expose a canonical enum (e.g. LifecycleEventType) in io.serverlessworkflow.impl.lifecycle, ideally with:
- One value per concrete
WorkflowEvent subtype (workflow- and task-level).
- A way to classify an arbitrary
WorkflowEvent instance to its LifecycleEventType (replacing the instanceof chains each consumer currently writes).
- A link back to the matching
LifecycleEvents CE-id constant, if practical.
This would let consumers (like Quarkus Flow's opentelemetry and testing modules) drop their local duplicates and depend on a single sdk-java-owned source of truth.
sdk-javacurrently models workflow/task lifecycle events as a set of concrete classes (WorkflowStartedEvent,TaskCompletedEvent, etc., inio.serverlessworkflow.impl.lifecycle) plus a separate class of CloudEvent-type string constants (LifecycleEvents). There's no single enum identifying "what kind of event is this" that consumers can switch/filter on without aninstanceofchain or comparing againstLifecycleEventsstrings.Downstream, at least two consumers in
quarkiverse/quarkus-flowindependently reimplement this same taxonomy as local enums:opentelemetry/runtime:WorkflowEventType+TaskEventType, each pairing a constant with itsLifecycleEventsid and afromEvent(WorkflowEvent)classifier viainstanceofchecks.testing(quarkus-flow-testing):EventType, a flat 16-value enum covering both workflow- and task-level events, used to classify recorded events in test assertions.Both are hand-written mirrors of the same 16 event kinds sdk-java already defines via its event classes/
LifecycleEventsconstants.Request: Expose a canonical enum (e.g.
LifecycleEventType) inio.serverlessworkflow.impl.lifecycle, ideally with:WorkflowEventsubtype (workflow- and task-level).WorkflowEventinstance to itsLifecycleEventType(replacing theinstanceofchains each consumer currently writes).LifecycleEventsCE-id constant, if practical.This would let consumers (like Quarkus Flow's
opentelemetryandtestingmodules) drop their local duplicates and depend on a single sdk-java-owned source of truth.