FSharpModule

PackageFCQRS
Idiomatic-F# functional facade for FCQRS. Gives F# consumers the same one-call ergonomics the C# host-builder (HostExtensions.fs) gives C#, but with F# idioms: records-of-functions for the definitions, typed handles for the results, an explicit wiring pipeline, and plain helpers for saga side effects. It is a *pure addition* that wraps only the existing primitives (IActor.InitializeActor / SagaBuilder.initSimple / Query.init / InitializeSagaStarter / CreateCommandSubscription / Actor.api) and changes nothing in the C# interop layer or the core. open FCQRS.FSharp let api = Fcqrs.actor config loggerFactory (Some (Fcqrs.connect DBType.Sqlite conn)) "Cluster" let documents = Fcqrs.aggregate api { Name="Document"; Initial=...; Decide=...; Fold=... } let slugs = Fcqrs.aggregate api { Name="Slug"; Initial=...; Decide=...; Fold=... } let publication = Fcqrs.saga api (publicationDef documents.Factory slugs.Factory) Fcqrs.wireSagaStarters api [ publication ] let subs = Fcqrs.projection api (Projection.single 0 updateReadModel) // (Projection.multi when you must control which notifications publish) // send a command and await the matching aggregate reply: let! ev = documents.Send (Fcqrs.newCid()) (Fcqrs.aggregateId id) cmd (fun e -> ...)

Summary

NameSignatureSynopsis
toOriginatortoOriginator factory commandSend a command back to the saga's originator aggregate.
toAggregatetoAggregate factory id commandSend a command to a specific aggregate instance by id (cross-aggregate).
toActortoActor actorRef commandSend a command to a concrete actor ref.
toSelftoSelf commandSend a command to the saga itself (raw, lands in HandleEvent), for example a timeout.
toOriginatorAftertoOriginatorAfter factory delayMs taskName commandDelayed variant of toOriginator (delayMs, taskName key).
toAggregateAftertoAggregateAfter factory id delayMs taskName commandDelayed variant of toAggregate.
toActorAftertoActorAfter actorRef delayMs taskName commandDelayed variant of toActor.
toSelfAftertoSelfAfter delayMs taskName commandSchedule a message to the saga itself after a delay, the idiomatic saga timeout: enter a state, toSelfAfter a reminder, and HandleEvent decides whether it still matters when it arrives.
expectingexpecting deadline retryEvery resendDeclare a saga expectation: stay in this state, send `resend` now, re-send exactly those commands on `retryEvery`, and once `deadline` (measured from the persisted state-entry time, so restarts cannot postpone it) has passed without a state transition, deliver an ExpectationExhausted message to HandleEvent.
journalTypejournalType nameA (type, stable-journal-name) pair for Fcqrs.journalTypes.
persistpersist eventNo description available.
persistAllpersistAll eventsNo description available.
persistAndSnapshotpersistAndSnapshot eventNo description available.
deferdefer eventNo description available.
persistIfpersistIf shouldPersist eventPersist the event when `shouldPersist`, else defer it (published and folded but not journalled).
transitionTotransitionTo stateNo description available.
dispatchdispatch descriptionDispatch an async side effect (a "mini saga" without persistence) by its DATA description.
totaltotal onError workMake an effect-runner body TOTAL: run `work`, mapping ANY exception (oracle error, timeout, cancellation) to a command via `onError`, so the runner never lets an exception escape (which would fail-fast the process).
staystay No description available.
stopstop No description available.
nextStatenextState stateNo description available.

toOriginator

toOriginator factory command
Member
Send a command back to the saga's originator aggregate.

Parameters

NameTypeDescription
factoryAggregateFactory
commandobj

Returns

ExecuteCommand

toAggregate

toAggregate factory id command
Member
Send a command to a specific aggregate instance by id (cross-aggregate).

Parameters

NameTypeDescription
factoryAggregateFactory
idstring
commandobj

Returns

ExecuteCommand

toActor

toActor actorRef command
Member
Send a command to a concrete actor ref.

Parameters

NameTypeDescription
actorRefIActorRef<obj>
commandobj

Returns

ExecuteCommand

toSelf

toSelf command
Member
Send a command to the saga itself (raw, lands in HandleEvent), for example a timeout.

Parameters

NameTypeDescription
commandobj

Returns

ExecuteCommand

toOriginatorAfter

toOriginatorAfter factory delayMs taskName command
Member
Delayed variant of toOriginator (delayMs, taskName key).

Parameters

NameTypeDescription
factoryAggregateFactory
delayMsint64
taskNamestring
commandobj

Returns

ExecuteCommand

toAggregateAfter

toAggregateAfter factory id delayMs taskName command
Member
Delayed variant of toAggregate.

Parameters

NameTypeDescription
factoryAggregateFactory
idstring
delayMsint64
taskNamestring
commandobj

Returns

ExecuteCommand

toActorAfter

toActorAfter actorRef delayMs taskName command
Member
Delayed variant of toActor.

Parameters

NameTypeDescription
actorRefIActorRef<obj>
delayMsint64
taskNamestring
commandobj

Returns

ExecuteCommand

toSelfAfter

toSelfAfter delayMs taskName command
Member
Schedule a message to the saga itself after a delay, the idiomatic saga timeout: enter a state, toSelfAfter a reminder, and HandleEvent decides whether it still matters when it arrives.

Parameters

NameTypeDescription
delayMsint64
taskNamestring
commandobj

Returns

ExecuteCommand

expecting

expecting deadline retryEvery resend
Member
Declare a saga expectation: stay in this state, send `resend` now, re-send exactly those commands on `retryEvery`, and once `deadline` (measured from the persisted state-entry time, so restarts cannot postpone it) has passed without a state transition, deliver an ExpectationExhausted message to HandleEvent. The handler must answer it with a transition, typically to a failure or compensation state. Resend commands must be retry-safe and must not carry their own DelayInMs.

Parameters

NameTypeDescription
deadlineTimeSpan
retryEveryRetrySchedule
resendExecuteCommand list

Returns

SagaTransition<'State>

journalType

journalType name
Member
A (type, stable-journal-name) pair for Fcqrs.journalTypes.

Parameters

NameTypeDescription
namestring

Returns

Type * string

persist

persist event
Member

Parameters

NameTypeDescription
event'e

Returns

EventAction<'e>

persistAll

persistAll events
Member

Parameters

NameTypeDescription
events'e list

Returns

EventAction<'e>

persistAndSnapshot

persistAndSnapshot event
Member

Parameters

NameTypeDescription
event'e

Returns

EventAction<'e>

defer

defer event
Member

Parameters

NameTypeDescription
event'e

Returns

EventAction<'e>

persistIf

persistIf shouldPersist event
Member
Persist the event when `shouldPersist`, else defer it (published and folded but not journalled). The deferred fold should preserve state, because it cannot be replayed. This is the idempotent "emit this verdict, write it only once" shape.

Parameters

NameTypeDescription
shouldPersistbool
event'e

Returns

EventAction<'e>

transitionTo

transitionTo state
Member

Parameters

NameTypeDescription
state'state

Returns

EventAction<'state>

dispatch

dispatch description
Member
Dispatch an async side effect (a "mini saga" without persistence) by its DATA description. `decide` stays pure and inspectable; `decide cmd state = dispatch (ClusterThemes texts)` holds by structural equality, and the oracle lives in the runner registered at `Fcqrs.aggregateWithEffects`. EPHEMERAL: the in-flight work is not journaled; use a saga when the result must survive a crash. See `EventAction.RunAsync`.

Parameters

NameTypeDescription
description'description

Returns

EventAction<'event>

total

total onError work
Member
Make an effect-runner body TOTAL: run `work`, mapping ANY exception (oracle error, timeout, cancellation) to a command via `onError`, so the runner never lets an exception escape (which would fail-fast the process).

Parameters

NameTypeDescription
onErrorexn -> 'command
workAsync<'command>

Returns

Async<'command>

stay

stay
Member

Returns

SagaTransition<'state>

stop

stop
Member

Returns

SagaTransition<'state>

nextState

nextState state
Member

Parameters

NameTypeDescription
state'state

Returns

SagaTransition<'state>