Skip to content

Conversation

Robban1980
Copy link
Contributor

@Robban1980 Robban1980 commented Mar 17, 2025

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR

This PR adds the new Workflow Event Publisher kafka. It gives support to publish workflow events to Kafka. In addition to the existing events, Completed, Terminated and Finalized the following new events have been added:

  • STARTED
  • RERAN
  • RETRIED
  • PAUSED
  • RESUMED
  • RESTARTED
  • COMPLETED (supported by queue_publisher)
  • TERMINATED (supported by queue_publisher)
  • FINALIZED (supported by queue_publisher)

That addition of these new events does not change the behavior of the existing publishers, they are unchanged.

A new type WorkflowSummaryExtended was added that extends the WorkflowSummary, it maintains input and output properties as objects when publishing objects to Kafka.

Moved rising of Workflow FINALIZED event from cancelNonTerminalTasks to endExecution in the WorkflowExecutionOps.java to make sure it is only raised once. Currently when using a Terminate Task in a workflow it is razed twice.

To ensure that FINALIZED is raised to correct number of times, an overloaded cancelNonTerminalTasks was introduced to control if this event should be raised or not, by default it is raised. This is because the cancelNonTerminalTasks is called twice when endExecution is part of the flow. When cancelNonTerminalTasks is called from endExecution it should not raise the event again.

Issue #

- Added new WorkflowEventType with Additional events for the WorkflowStatusListener.
- Added WorkflowSummaryExtended that extends WorkflowSummary, it maintains input and output properties as objects when publishing objects to Kafka.
- Moved rasing of Workflow Finalized event from cancelNonTerminalTasks to endExecution to make sure it is only rasied once.
@Robban1980 Robban1980 marked this pull request as draft March 17, 2025 06:38
@Robban1980
Copy link
Contributor Author

Robban1980 commented Mar 17, 2025

Sent back to draft as i found that the does not work for the case where the workflow is terminated through the API/UI does not raise the Finalize event. So back to square one with duplicated finalized events.

@Robban1980 Robban1980 changed the title Feature/kafka workflow event listener [Feature] Adding support for Kafka in the Workflow Event Listener Mar 17, 2025
@Robban1980 Robban1980 marked this pull request as ready for review March 17, 2025 09:07
@Robban1980
Copy link
Contributor Author

finalized is now raised the correct amount of times.

@jeffbulltech jeffbulltech added help wanted Extra attention is needed feature Requesting a feature be added labels Mar 18, 2025
@jeffbulltech
Copy link

Thanks @Robban1980 ! I've assigned it to an engineer and labeled.

Copy link
Contributor

@bradyyie bradyyie left a comment

Choose a reason for hiding this comment

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

Looks good - code is clean and allows the statuses to be pushed back to kafka as stated

@v1r3n v1r3n merged commit 6b545ee into conductor-oss:main Apr 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Requesting a feature be added help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants