Skip to content

Workflows in WAITING status cannot be restored after application restart #1245

@mcruzdev

Description

@mcruzdev

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:

  1. A workflow executes and reaches a listen() task
  2. The workflow enters WAITING status and is persisted
  3. The application restarts
  4. The workflow is restored from persistence
  5. An event is emitted that the workflow is waiting for
  6. 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:

  1. Re-register their event listeners
  2. Receive events that they are waiting for
  3. Continue execution from the point where they were waiting
  4. Complete successfully

How to reproduce it:

  1. 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();
  1. Restart the application

  2. Emit the event that the workflow is waiting for.

Metadata

Metadata

Assignees

Labels

javaPull requests that update java code

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions