Header menu logo FCQRS

ActorWiring Type

Low-level wiring over an IActor: register the saga-starter, aggregates and actors, and send commands. Most members are plain static helpers (you call ActorWiring.Foo(actor, …)); a couple are genuine extension methods. For app composition, prefer the host-builder API (AddFcqrs/AddAggregate/AddSaga).

Static members

Static member Description

ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)

Full Usage: ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)

Parameters:
Returns: Async<Event<'TEvent>>

C#-friendly CreateCommandSubscription that returns FSharpAsync (for use with Handler delegate)

actor : IActor
entityFactory : AggregateFactory
cid : CID
aggregateId : AggregateId
command : 'TCommand
filter : Func<'TEvent, bool>
Returns: Async<Event<'TEvent>>

ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)

Full Usage: ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)

Parameters:
Returns: EntityFac<obj>

InitActor with an explicit per-aggregate snapshot policy.

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
snapshotPolicy : SnapshotPolicy
Returns: EntityFac<obj>

ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent)

Full Usage: ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent)

Parameters:
Returns: EntityFac<obj>

C#-friendly InitializeActor that accepts Func delegates instead of F# functions

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
Returns: EntityFac<obj>

ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)

Full Usage: ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)

Parameters:
Returns: EntityFac<obj>

InitActor whose decide can return `EventActions.Dispatch(...)` (the RunAsync effect). `runner` maps a boxed effect description to a Task of the boxed command self-dispatched back to the aggregate. It MUST be total catch every failure into a command (try/catch in the Task); an escaping exception fail-fasts the process, like a throwing fold. The in-flight work is NOT journaled (ephemeral). See EventAction.RunAsync.

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
runner : Func<obj, Task<obj>>
snapshotPolicy : SnapshotPolicy
Returns: EntityFac<obj>

ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)

Full Usage: ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)

Parameters:
Returns: AggregateRefs<'TCommand, 'TEvent>

InitAggregate with an explicit per-aggregate snapshot policy.

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
snapshotPolicy : SnapshotPolicy
Returns: AggregateRefs<'TCommand, 'TEvent>

ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent)

Full Usage: ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent)

Parameters:
Returns: AggregateRefs<'TCommand, 'TEvent>

One-call aggregate wiring: registers the aggregate (sharding region) and returns its Factory + Handler. Collapses the Init/Factory/Handler trio an aggregate would otherwise hand-roll. Call it for EVERY aggregate you want live. Registration is the act of calling this, not a side effect.

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
Returns: AggregateRefs<'TCommand, 'TEvent>

ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)

Full Usage: ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)

Parameters:
Returns: AggregateRefs<'TCommand, 'TEvent>

InitAggregate whose decide can return `EventActions.Dispatch(...)`. See InitActorWithRunner. Returns Factory + Handler like InitAggregate.

actor : IActor
initialState : 'TState
entityName : string
handleCommand : Func<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEvent : Func<Event<'TEvent>, 'TState, 'TState>
runner : Func<obj, Task<obj>>
snapshotPolicy : SnapshotPolicy
Returns: AggregateRefs<'TCommand, 'TEvent>

ActorWiring.InitSagaStarter(actor, eventHandler)

Full Usage: ActorWiring.InitSagaStarter(actor, eventHandler)

Parameters:

C#-friendly InitializeSagaStarter that accepts Func returning IList of SagaDefinition. A null list means "no sagas". Null Factory/StartingEvent members fail with a named error: this handler runs inside the SagaStarter during the saga-start handshake, where a bare NRE used to surface 30s later as a misleading handshake-timeout FailFast.

actor : IActor
eventHandler : Func<obj, IList<SagaDefinition>>

ActorWiring.InitSagaStarterEmpty(actor)

Full Usage: ActorWiring.InitSagaStarterEmpty(actor)

Parameters:

Static helper for C# where extension may not resolve

actor : IActor

ActorWiring.InitSagaStarterSimple(actor, eventHandler)

Full Usage: ActorWiring.InitSagaStarterSimple(actor, eventHandler)

Parameters:

C#-friendly simplified InitializeSagaStarter where you just return factories. A null list means "no sagas"; a null factory fails with a named error.

actor : IActor
eventHandler : Func<obj, IList<AggregateFactory>>

ActorWiring.InitializeSagaStarterEmpty(actor)

Full Usage: ActorWiring.InitializeSagaStarterEmpty(actor)

Parameters:

Initialize saga starter with no sagas (for simple scenarios)

actor : IActor

ActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter)

Full Usage: ActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter)

Parameters:
Returns: Task<Event<'TEvent>>

Send a command and wait for the event (C# friendly)

actor : IActor
entityFactory : AggregateFactory
cid : CID
aggregateId : AggregateId
command : 'TCommand
filter : Func<'TEvent, bool>
Returns: Task<Event<'TEvent>>

Type something to start searching.