What happened:
Workflows that enter WAITING status (e.g., at listen() tasks waiting for CloudEvents) cannot be properly restored after application restart. When the application restarts and attempts to restore persisted workflows, the restored workflows fail to receive events because event listeners are not re-registered.
Specifically:
- A workflow executes and reaches a
listen() task
- The workflow enters
WAITING status and is persisted
- The application restarts
- The workflow is restored from persistence
- An event is emitted that the workflow is waiting for
- The workflow does not receive the event because event listeners were not re-registered during restoration
What you expected to happen:
After application restart, restored workflows in WAITING status should:
- Re-register their event listeners
- Receive events that they are waiting for
- Continue execution from the point where they were waiting
- Complete successfully
How to reproduce it:
- Create a workflow with a
listen() task:
FuncWorkflowBuilder.workflow("listenWorkflow")
.tasks(
set(Map.of("message", "hello")),
listen("waitEvent", toOne("my.event.type")),
function("processEvent", o -> {
System.out.println("Received: " + o);
return "success";
}, Object.class)
)
.build();
-
Restart the application
-
Emit the event that the workflow is waiting for.
What happened:
Workflows that enter
WAITINGstatus (e.g., atlisten()tasks waiting for CloudEvents) cannot be properly restored after application restart. When the application restarts and attempts to restore persisted workflows, the restored workflows fail to receive events because event listeners are not re-registered.Specifically:
listen()taskWAITINGstatus and is persistedWhat you expected to happen:
After application restart, restored workflows in
WAITINGstatus should:How to reproduce it:
listen()task:Restart the application
Emit the event that the workflow is waiting for.