Skip to content

[Fix #1286] Non blocking persistence#1288

Merged
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1286
Apr 6, 2026
Merged

[Fix #1286] Non blocking persistence#1288
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1286

Conversation

@fjtirado
Copy link
Copy Markdown
Collaborator

@fjtirado fjtirado commented Apr 1, 2026

Fix #1286

@fjtirado fjtirado marked this pull request as ready for review April 1, 2026 17:41
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This will create backward incompatibility on qflow when released, but I guess it is acceptable (we are swithcing to AsyncPersistenceExceutor

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

Implements non-blocking persistence by moving workflow lifecycle listeners to a CompletableFuture-based contract and switching default persistence execution to async.

Changes:

  • Introduces WorkflowExecutionCompletableListener and adapts existing WorkflowExecutionListener implementations via an adapter.
  • Refactors lifecycle event publishing to return/compose CompletableFutures rather than fire-and-forget.
  • Updates persistence executors/writers to use a unified execute(...) path and defaults to AsyncPersistenceExecutor.

Reviewed changes

Copilot reviewed 19 out of 19 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/WorkflowPersistenceListener.java Migrates persistence listener callbacks to return CompletableFuture for async persistence writes.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/WorkflowPersistenceInstance.java Adjusts async control flow in start() to return a CompletableFuture from a callback.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/TransactedPersistenceInstanceWriter.java Uses PersistenceExecutor.execute(...) uniformly (removes start/delete special-casing).
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/SyncPersistenceExecutor.java Removes synchronous executor implementation.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/PersistenceExecutor.java Simplifies executor API by removing startInstance/deleteInstance defaults.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/DefaultPersistenceInstanceHandlers.java Defaults persistence execution to AsyncPersistenceExecutor when none provided.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/AsyncPersistenceExecutor.java Makes async executor publicly constructible and adds a no-arg constructor.
impl/persistence/api/src/main/java/io/serverlessworkflow/impl/persistence/AbstractAsyncPersistenceExecutor.java Reworks async execution implementation (removes per-instance chaining/close drain).
impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowListenerTest.java Updates tests to use the new completable listener type.
impl/core/src/test/java/io/serverlessworkflow/impl/TopPriorityListener.java Updates test listener to implement WorkflowExecutionCompletableListener.
impl/core/src/test/java/io/serverlessworkflow/impl/MediumPriorityListener.java Updates test listener to implement WorkflowExecutionCompletableListener.
impl/core/src/test/java/io/serverlessworkflow/impl/LowestPriorityListener.java Updates test listener to implement WorkflowExecutionCompletableListener.
impl/core/src/main/java/io/serverlessworkflow/impl/lifecycle/WorkflowExecutionListenerAdapter.java Adds adapter from legacy listener to completable listener.
impl/core/src/main/java/io/serverlessworkflow/impl/lifecycle/WorkflowExecutionCompletableListener.java Adds new async listener interface with default completed futures.
impl/core/src/main/java/io/serverlessworkflow/impl/lifecycle/LifecycleEventsUtils.java Refactors event publishing to return a combined CompletableFuture.
impl/core/src/main/java/io/serverlessworkflow/impl/executors/AbstractTaskExecutor.java Composes task lifecycle events into the task execution future chain.
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Composes workflow start/completion events into the workflow execution future chain.
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Stores completable listeners, adapts legacy listeners loaded via ServiceLoader, updates builder APIs.
impl/core/src/main/java/io/serverlessworkflow/impl/SchedulerListener.java Migrates scheduler listener to completable listener callback shape.

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

Copilot AI review requested due to automatic review settings April 6, 2026 10:50
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 19 out of 19 changed files in this pull request and generated no new comments.


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

Signed-off-by: fjtirado <ftirados@redhat.com>
Update impl/core/src/main/java/io/serverlessworkflow/impl/SchedulerListener.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update impl/core/src/main/java/io/serverlessworkflow/impl/lifecycle/WorkflowExecutionListenerAdapter.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@gmunozfe gmunozfe 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 to me, works like a charm, nice fixing @fjtirado !

@fjtirado fjtirado merged commit f6bca62 into serverlessworkflow:main Apr 6, 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 integration of Listeners execution into the Workflow execution

3 participants