Skip to content

Add 'on' property to EventConsumptionStrategy to align with specification #1341

@ricardozanini

Description

@ricardozanini

What would you like to be added

Add the on property to the EventConsumptionStrategy in both the schema and DSL/FuncDSL classes to fully align with the Serverless Workflow specification.

Current State

The EventConsumptionStrategy currently supports three consumption strategies in the schema (types/src/main/resources/schema/workflow.yaml):

  • all - AllEventConsumptionStrategy
  • any - AnyEventConsumptionStrategy
  • one - OneEventConsumptionStrategy

The DSL classes (fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/DSL.java and experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java) provide helper methods like one(), all(), and any() for schedule event strategies, but these delegate to the builder which doesn't support the on property at the EventConsumptionStrategy level.

Specification Reference

According to the DSL Reference, the Event Consumption Strategy should include an on property:

Property Type Required Description
on eventConsumptionStrategy no "Specifies the events that trigger the workflow execution."
Required when no other property has been set.

This is distinct from the already-implemented schedule.on (workflow-level event trigger) - the on property here is part of the event consumption strategy itself and allows recursive/nested event consumption strategies.

Why is this needed

To fully implement the specification and provide complete API coverage for event consumption strategies. This property enables recursive event consumption patterns that are defined in the spec.

Proposed Changes

  1. Schema (types/src/main/resources/schema/workflow.yaml): Add a fourth oneOf option to eventConsumptionStrategy for the on property
  2. Builder (fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/AbstractEventConsumptionStrategyBuilder.java): Add an on() method
  3. DSL Classes: The existing DSL helper methods may already cover this if they delegate properly to the builder

Related Issues

Note: Those issues addressed schedule.on at the workflow level, not the on property within EventConsumptionStrategy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    javaPull requests that update java codespec:1.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions