Skip to content

[Fix #1406] Allow adding data into lifecycle CloudEvents#1410

Merged
fjtirado merged 2 commits into
serverlessworkflow:mainfrom
fjtirado:Fix_#1406
May 29, 2026
Merged

[Fix #1406] Allow adding data into lifecycle CloudEvents#1410
fjtirado merged 2 commits into
serverlessworkflow:mainfrom
fjtirado:Fix_#1406

Conversation

@fjtirado
Copy link
Copy Markdown
Collaborator

Fix #1406

Copilot AI review requested due to automatic review settings May 28, 2026 15:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an extensibility point to customize the data payload of lifecycle CloudEvents emitted by the runtime. The previous record-based CE data types are converted to class hierarchies (WorkflowCEData/TaskCEData bases + per-event subclasses) so they can be overridden, and a new WorkflowLifeCycleCloudEventFactory (with default + opt-in InputOutputLifeCycleCloudEventFactory implementations) lets users plug in CE data containing workflow/task input/output.

Changes:

  • Introduce WorkflowLifeCycleCloudEventFactory (+ default and input/output factories) and wire it into WorkflowApplication via a new withLifeCycleCloudEventFactory builder hook.
  • Convert each *CEData record to a class extending new WorkflowCEData/TaskCEData bases, and have AbstractLifeCyclePublisher build CE data through the factory rather than constructing records inline.
  • Add WorkflowStartedCEDataWithInput, WorkflowCompletedCEDataWithOutput, TaskStartedCEDataWithInput, TaskCompletedCEDataWithOutput carrying WorkflowModel payloads; update LifeCycleEventsTest to use the input/output factory.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
impl/core/.../WorkflowApplication.java New lifeCycleCloudEventFactory field, builder setter, default-on-build, and accessor.
impl/core/.../lifecycle/ce/AbstractLifeCyclePublisher.java Replaces inline CE data construction with delegation to the factory; drops local id/pos helpers.
impl/core/.../lifecycle/ce/WorkflowLifeCycleCloudEventFactory.java New factory interface with per-event build methods (and an unused build(CloudEventBuilder) overload).
impl/core/.../lifecycle/ce/DefaultLifeCycleCloudEventFactory.java Default factory producing the base CE data types.
impl/core/.../lifecycle/ce/InputOutputLifeCycleCloudEventFactory.java Opt-in factory returning input/output-bearing CE data for started/completed events.
impl/core/.../lifecycle/ce/WorkflowCEData.java, TaskCEData.java New base classes consolidating common fields and id/pos/ref helpers.
impl/core/.../lifecycle/ce/Workflow{Started,Completed,Cancelled,Failed,Resumed,Suspended}CEData.java Records replaced with classes constructed from events; expose fluent accessors and toString.
impl/core/.../lifecycle/ce/WorkflowStatusCEDataEvent.java Same conversion for the status-change CE data.
impl/core/.../lifecycle/ce/Task{Started,Completed,Cancelled,Failed,Resumed,Retried,Suspended}CEData.java Same conversion for task CE data; TaskRetriedCEData uses getRetriedAt() and TaskResumedCEData.resumedAt is non-final.
impl/core/.../lifecycle/ce/{Workflow,Task}{Started,Completed}CEDataW{Input,Output}.java New subclasses adding WorkflowModel input/output fields.
impl/test/.../LifeCycleEventsTest.java Registers InputOutputLifeCycleCloudEventFactory and asserts on the new W-Output subtypes/WorkflowModel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fjtirado fjtirado marked this pull request as draft May 28, 2026 16:07
@fjtirado fjtirado force-pushed the Fix_#1406 branch 3 times, most recently from 0513cf7 to d2a7777 Compare May 28, 2026 18:14
@fjtirado fjtirado requested a review from ricardozanini May 28, 2026 18:15
@fjtirado fjtirado marked this pull request as ready for review May 28, 2026 18:15
Copilot AI review requested due to automatic review settings May 28, 2026 18:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Comment thread impl/lifecycleevent/pom.xml
Copy link
Copy Markdown
Collaborator

@mcruzdev mcruzdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fjtirado are you mind to depreacted access methods left by record, or it is so much?

It looks really great!

Copilot AI review requested due to automatic review settings May 29, 2026 09:17
@fjtirado
Copy link
Copy Markdown
Collaborator Author

Hi @fjtirado are you mind to depreacted access methods left by record, or it is so much?

It looks really great!

I do not think we should deprecate any of the getters, we can leave both (the getXXX is needed by Jackson to work, the preferred one should still be the xxx record like )

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.

…vents

Signed-off-by: fjtirado <ftirados@redhat.com>
Signed-off-by: fjtirado <ftirados@redhat.com>
Copilot AI review requested due to automatic review settings May 29, 2026 10:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

@fjtirado fjtirado merged commit af97b9c into serverlessworkflow:main May 29, 2026
3 checks passed
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.

Allow customization of the content of Lifecycle cloudevents

4 participants