Skip to content

Use FlowState directly in QueueManager#132

Merged
stidsborg merged 3 commits into
mainfrom
queuemanager-uses-flowstate
Apr 18, 2026
Merged

Use FlowState directly in QueueManager#132
stidsborg merged 3 commits into
mainfrom
queuemanager-uses-flowstate

Conversation

@stidsborg
Copy link
Copy Markdown
Owner

Summary

  • QueueManager now stores a direct FlowState reference (attached by FlowsManager.AddFlow) instead of calling FlowsManager methods keyed by StoredId.
  • Removes the now-unused per-id dispatch methods from FlowsManager (SignalInterrupt, GetInterruptedSignal, SuspendThread, ThreadResumed). Suspend stays (still used by DistributedSemaphore).
  • Includes an in-flight ThreadsSubflows rename on FlowState.

Test plan

  • dotnet test ./Core/Cleipnir.ResilientFunctions.Tests (messaging + full suite)
  • DB-backed suites (Postgres / SqlServer / MariaDB)

QueueManager now holds a direct FlowState reference (attached by
FlowsManager.AddFlow) instead of routing per-flow calls through
FlowsManager and a dictionary lookup by StoredId. Removes the
corresponding per-id dispatch methods from FlowsManager.

Also includes an in-flight Threads -> Subflows rename on FlowState.
Break the FlowState <-> QueueManager construction cycle by dropping
QueueManager from FlowState. FlowsManager now exposes CreateFlowState
so callers can build FlowState first, pass it into QueueManager via
ctor, and then register it with AddFlow(flowState).

Separates the two interrupt signals:
- QueueManager-local _interruptSignal fires when new messages arrive
  (woken by Subscribe).
- flowState.InterruptSignal fires on external interrupt and is picked
  up by QueueManager's Initialize loop to trigger FetchMessagesOnce.

FlowsManager.Interrupt no longer reaches into QueueManager; it just
fires flowState.Interrupt().
When PersistFunctionInStore returns persisted=false the caller only needs
the flag to take the early-return branch, so skip constructing effect,
correlations, semaphores, flow state, queue manager and workflow.

Also completes the CreateFlowState+AddFlow -> CreateFlow migration across
the remaining Invoker call sites and the Messaging test templates.
@stidsborg stidsborg merged commit 9d1a25e into main Apr 18, 2026
8 checks passed
@stidsborg stidsborg deleted the queuemanager-uses-flowstate branch April 18, 2026 08:23
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.

1 participant