FSharp Module
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 -> ...)
Types and nested modules
| Type/Module | Description |
Functions and values
| Function or value | Description |
|
|
Full Usage:
dispatch description
Parameters:
'description
Returns: EventAction<'event>
|
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`.
|
Full Usage:
expecting deadline retryEvery resend
Parameters:
TimeSpan
retryEvery : RetrySchedule
resend : ExecuteCommand list
Returns: SagaTransition<'State>
|
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.
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
persistIf shouldPersist event
Parameters:
bool
event : 'e
Returns: EventAction<'e>
|
|
|
|
|
|
Full Usage:
toActor actorRef command
Parameters:
IActorRef<obj>
command : obj
Returns: ExecuteCommand
|
|
Full Usage:
toActorAfter actorRef delayMs taskName command
Parameters:
IActorRef<obj>
delayMs : int64
taskName : string
command : obj
Returns: ExecuteCommand
|
|
Full Usage:
toAggregate factory id command
Parameters:
AggregateFactory
id : string
command : obj
Returns: ExecuteCommand
|
|
Full Usage:
toAggregateAfter factory id delayMs taskName command
Parameters:
AggregateFactory
id : string
delayMs : int64
taskName : string
command : obj
Returns: ExecuteCommand
|
|
Full Usage:
toOriginator factory command
Parameters:
AggregateFactory
command : obj
Returns: ExecuteCommand
|
|
Full Usage:
toOriginatorAfter factory delayMs taskName command
Parameters:
AggregateFactory
delayMs : int64
taskName : string
command : obj
Returns: ExecuteCommand
|
|
|
|
Full Usage:
toSelfAfter delayMs taskName command
Parameters:
int64
taskName : string
command : obj
Returns: ExecuteCommand
|
|
|
|
|
|
FCQRS