Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud events to be publlished when workflow status change #1030

Open
fjtirado opened this issue Nov 20, 2024 · 5 comments · May be fixed by #1054
Open

Cloud events to be publlished when workflow status change #1030

fjtirado opened this issue Nov 20, 2024 · 5 comments · May be fixed by #1054
Assignees
Labels
area: spec Changes in the Specification change: documentation Improvements or additions to documentation. It won't impact a version change. change: feature New feature or request. Impacts in a minor version change
Milestone

Comments

@fjtirado
Copy link
Collaborator

fjtirado commented Nov 20, 2024

Possible workflow status are defined in the specifcation. However, there is not information of the content of the cloud event that very likely any implementation might publish when status is changed.

What would you like to be added:
Common content of the cloud events to be published when a status is changed

Why is this needed:
To make it possible users of any implementation to rely on the common content when listening to a status phase change event.

@fjtirado
Copy link
Collaborator Author

fjtirado commented Nov 20, 2024

The first thing (my guess) that we should decide is between:

  1. Publishing a different event type per status phase: started, aborted, complete...
  2. Publishing the same event type (StatusChangeEvent) and include the old and the new status, preferably as cloud event attributes
  3. Other ;)

It is easier to consume different event types by another workflow (you just put the type on the event task) while using attributes requires filtering of those attributes (if they are cloud event attributes, there wont be need to deserialize the data to perform the filter, at least theoretically)

Regardless the decision on that question, my bet is that, besides the status itself, we should include the workflow name plus the current input and context (if context is large, the event will be potentially huge, I guess that we can let implementors to leave that configurable)

@cdavernas
Copy link
Member

cdavernas commented Nov 20, 2024

I'd definitly go for your first suggestion, which makes routing/processing easier and more compliant with the Cloud Event Spec: the payload of the events should be opaque to those concerns.

If required, though, we could also add a Workflow/Task Status Changed event, used by "lazy" consumers to reflect status changes (it would be a kind of duplicate of other events, but with a simplistic payload limited to status).

As for the events types, I'd recommend using the following:

Type Description
io.serverlessworkflow.workflows.started.v1
Notifies about the start of a workflow instance.
io.serverlessworkflow.workflows.suspended.v1
Notifies about suspending a workflow instance execution.
io.serverlessworkflow.workflows.resumed.v1
Notifies about resuming a workflow instance execution.
io.serverlessworkflow.workflows.cancelled.v1
Notifies about the cancellation of a workflow instance execution.
io.serverlessworkflow.workflows.faulted.v1
Notifies about a workflow instance being faulted.
io.serverlessworkflow.workflows.completed.v1
Notifies about the completion of a workflow instance execution.
io.serverlessworkflow.workflows.correlation-started.v1
Notifies about a workflow instance starting to correlate events.
io.serverlessworkflow.workflows.correlation-completed.v1
Notifies about a workflow instance completing an event correlation.
io.serverlessworkflow.tasks.started.v1
Notifies about the start of a task.
io.serverlessworkflow.tasks.suspended.v1
Notifies about suspending a task's execution.
io.serverlessworkflow.tasks.resumed.v1
Notifies about resuming a task's execution.
io.serverlessworkflow.tasks.cancelled.v1
Notifies about the cancellation of a task's execution.
io.serverlessworkflow.tasks.faulted.v1
Notifies about a task being faulted.
io.serverlessworkflow.tasks.completed.v1
Notifies about the completion of a task's execution.

@fjtirado
Copy link
Collaborator Author

@cdavernas Ill open PR to incorporate your proposal to the spec, thanks a lot!!!

@cdavernas cdavernas added change: documentation Improvements or additions to documentation. It won't impact a version change. change: feature New feature or request. Impacts in a minor version change area: spec Changes in the Specification labels Dec 16, 2024
@cdavernas cdavernas added this to the v1.0.0 milestone Dec 16, 2024
@cdavernas cdavernas assigned cdavernas and unassigned cdavernas Jan 8, 2025
@cdavernas
Copy link
Member

cdavernas commented Jan 8, 2025

@fjtirado Are you still on it? Otherwise I can do it if you prefer ;)

@fjtirado
Copy link
Collaborator Author

fjtirado commented Jan 8, 2025

@cdavernas Hi, please go ahead, thanks a lot!

@cdavernas cdavernas assigned cdavernas and unassigned fjtirado Jan 8, 2025
cdavernas added a commit to neuroglia-io/serverless-workflow-specification that referenced this issue Jan 9, 2025
@cdavernas cdavernas linked a pull request Jan 9, 2025 that will close this issue
8 tasks
@cdavernas cdavernas linked a pull request Jan 9, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: spec Changes in the Specification change: documentation Improvements or additions to documentation. It won't impact a version change. change: feature New feature or request. Impacts in a minor version change
Projects
Status: Backlog
2 participants