Skip to content

[Fix #1395] AllStrategyCorrelation persistence#1396

Draft
fjtirado wants to merge 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1395
Draft

[Fix #1395] AllStrategyCorrelation persistence#1396
fjtirado wants to merge 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1395

Conversation

@fjtirado
Copy link
Copy Markdown
Collaborator

Fix #1395

Copilot AI review requested due to automatic review settings May 20, 2026 12:08
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

This PR addresses issue #1395 by extending the persistence API to better support “all/AND” event correlation and enabling persistence implementations to clean up correlated CloudEvents once a workflow instance has started.

Changes:

  • Add persistence hooks for “all strategy” correlation (correlateEvent) and CloudEvent cleanup (removeCloudEvents), plus a helper PersistenceAllStrategyCorrelationInfo.
  • Propagate correlated CloudEvent IDs via workflow instance metadata, and remove those events during persistence started(...).
  • Update scheduling flow to pass WorkflowInstance (not just WorkflowModel) so metadata can be attached before starting.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/TransactedPersistenceInstanceWriter.java Adjust executor invocation to pass WorkflowDefinitionData instead of full context.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/PersistenceInstanceOperations.java Add default persistence extension points for CloudEvent cleanup and “all strategy” correlation.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/PersistenceExecutor.java Change executor API to accept WorkflowDefinitionData and add Supplier-based execution.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/PersistenceAllStrategyCorrelationInfo.java New helper implementing AllStrategyCorrelationInfo using persistence operations + executor.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/AbstractPersistenceInstanceWriter.java On workflow start, remove persisted CloudEvents referenced in instance metadata.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/AbstractAsyncPersistenceExecutor.java Implement new PersistenceExecutor API (Runnable + Supplier overloads).
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Introduce metadata key constant and metadata helper methods.
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowInstanceData.java Add findMetadata to surface instance metadata.
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowInstance.java Add addMetadataIfAbsent to allow attaching metadata before starting instances.
impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/ScheduledInstanceRunnable.java Switch scheduling runner to accept WorkflowInstance directly.
impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/ScheduledEventConsumer.java Attach correlated CloudEvent IDs to the instance before scheduling start.
impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/DefaultWorkflowScheduler.java Update cron runner to align with WorkflowInstance-based scheduling runner.

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

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Outdated
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Outdated
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings May 20, 2026 13: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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings May 20, 2026 13:34
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings May 20, 2026 15:34
@fjtirado fjtirado force-pushed the Fix_#1395 branch 2 times, most recently from ff67ce9 to d929a3b Compare May 20, 2026 15:46
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@fjtirado fjtirado marked this pull request as draft May 20, 2026 16:16
@fjtirado fjtirado force-pushed the Fix_#1395 branch 2 times, most recently from 4141a67 to 9af4051 Compare May 20, 2026 17:31
…lation

Signed-off-by: fjtirado <ftirados@redhat.com>
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.

AllStrategyCorrelationInfo persistence default implementation

2 participants