Skip to content

Only the last workflow using schedule.on.all is started #1868

Description

@mathecruz

When two workflow definitions in the same WorkflowApplication use schedule.on.all, only the last registered one is ever started. Events for the other one are silently dropped.

The default AllStrategyCorrelationInfoFactory always returns the same singleton:

allStrategyCorrelationInfoFactory = definition -> InMemoryAllStrategyCorrelationInfo.instance();

and InMemoryAllStrategyCorrelationInfo#init replaces its state (registrations and starter) for every definition, so the last one wins.

Reproduce: register two workflows with schedule.on.all (e.g. one on order.placed, another on order.shipped) and publish the matching events. Only the second workflow gets an instance.

Activity

  1. changed the title [-]Two workflows scheduled with `schedule.on.all` in the same `WorkflowApplication` interfere: only the last one is ever started[/-] [+]Only the last workflow using `schedule.on.all` is started[/+] on Nov 23, 2026
  2. self-assigned this
    on Nov 23, 2026
  3. added
    java
    on Nov 23, 2026
  4. added theissue type on Nov 23, 2026
  5. mathecruz commented on Nov 23, 2026

    @mathecruz
    CollaboratorAuthor

    Currently we have one InMemoryAllStrategyCorrelationInfo per JVM. If we have two WorkflowApplication in the same JVM both uses the same InMemoryAllStrategyCorrelationInfo which sounds weird.

    Proposal:

    1. Allow one InMemoryAllStrategyCorrelationInfo per WorkflowApplication (1:1) and InMemoryAllStrategyCorrelationInfo for n WorkflowDefinition (1:n)
    2. Allow one InMemoryAllStrategyCorrelationInfo per WorkflowApplication (1:1) and InMemoryAllStrategyCorrelationInfo per WorkflowDefinition (1:1)
  6. mathecruz commented on Nov 23, 2026

    @mathecruz
    CollaboratorAuthor

    I prefer the option 1, do you have another thing in mind @fjtirado?

  7. self-assigned this
    on Nov 24, 2026
  8. fjtirado commented on Nov 24, 2026

    @fjtirado
    Collaborator

    @mathecruz
    The way this is implemented, I think there should be one InMemoryAllStrategyCorrelationInfo per WorkflowDefinition.
    There is a part of the information (the events) that can be stored an applicaiton level (thas why the persistence strategy is not affected by this PR, the event DB is global) to save some memory (but the event itself is not duplicated, just the list, so it is not big deal)

  9. fjtirado commented on Nov 24, 2026

    @fjtirado
    Collaborator

    @mathecruz Im filing a PR for this one (since Im not sure we are fully aligned on the solution). Please check that the persistence implementation (Qflow should not be using this InMemory one for multi cluste) do not have the same issue. It should not, but Qflow is a good place to add a test to ensure it.

  10. added a commit that references this issue on Nov 26, 2026
    226a2b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

java

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions