ActorWiringType

PackageFCQRS
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).

Specification

Kind
Type
Members
19
Examples
0
CreateCommandSignature
ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)
InitActorSignature
ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy)
InitActorSignature
ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)
InitActorSignature
ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent)
InitActorWithRunnerSignature
ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy)

Summary

NameSignatureSynopsis
CreateCommandActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)C#-friendly CreateCommandSubscription that returns FSharpAsync (for use with Handler delegate)
InitActorActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy)InitActor with explicit per-aggregate snapshot and idle-passivation policies.
InitActorActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)InitActor with an explicit per-aggregate snapshot policy.
InitActorActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent)C#-friendly InitializeActor that accepts Func delegates instead of F# functions
InitActorWithRunnerActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy)InitActorWithRunner with an explicit idle-passivation policy.
InitActorWithRunnerActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)InitActor whose decide can return `EventActions.Dispatch(...)` (the RunAsync effect).
InitAggregateActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy)InitAggregate with explicit per-aggregate snapshot and idle-passivation policies.
InitAggregateActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)InitAggregate with an explicit per-aggregate snapshot policy.
InitAggregateActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent)One-call aggregate wiring: registers the aggregate (sharding region) and returns its Factory + Handler.
InitAggregateWithEffectsActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy)InitAggregateWithEffects with an explicit idle-passivation policy.
InitAggregateWithEffectsActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)InitAggregate whose decide can return `EventActions.Dispatch(...)`.
InitSagaStarterActorWiring.InitSagaStarter(actor, eventHandler)C#-friendly InitializeSagaStarter that accepts Func returning IList of SagaDefinition.
InitSagaStarterEmptyActorWiring.InitSagaStarterEmpty(actor)Static helper for C# where extension may not resolve
InitSagaStarterSimpleActorWiring.InitSagaStarterSimple(actor, eventHandler)C#-friendly simplified InitializeSagaStarter where you just return factories.
InitializeSagaStarterEmptyActorWiring.InitializeSagaStarterEmpty(actor)Initialize saga starter with no sagas (for simple scenarios)
SendCommandAsyncActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter)Send a command and wait for the event (C# friendly)
SendIfVersionAsyncActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter, cancellationToken)Send a conditional command with cancellation of the caller's wait.
SendIfVersionAsyncActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter)Send only when the aggregate's persisted version equals expectedVersion (initially zero).
WithEventUpcasterActorWiring.WithEventUpcaster(actor, convert)Register a deterministic, one-to-one historical event conversion for this actor system.

CreateCommand

ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)
Member
C#-friendly CreateCommandSubscription that returns FSharpAsync (for use with Handler delegate)

Parameters

NameTypeDescription
actorIActor
entityFactoryAggregateFactory
cidCID
aggregateIdAggregateId
command'TCommand
filterFunc<'TEvent, bool>

Returns

Async<Event<'TEvent>>

InitActor

ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy)
Member
InitActor with explicit per-aggregate snapshot and idle-passivation policies.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
snapshotPolicySnapshotPolicy
passivationPolicyPassivationPolicy

Returns

EntityFac<obj>

InitActor

ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)
Member
InitActor with an explicit per-aggregate snapshot policy.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
snapshotPolicySnapshotPolicy

Returns

EntityFac<obj>

InitActor

ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent)
Member
C#-friendly InitializeActor that accepts Func delegates instead of F# functions

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>

Returns

EntityFac<obj>

InitActorWithRunner

ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy)
Member
InitActorWithRunner with an explicit idle-passivation policy. RunAsync work is ephemeral, so an aggregate that dispatches long effects is a candidate for a longer idle timeout: passivation drops work still in flight.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
runnerFunc<obj, Task<obj>>
snapshotPolicySnapshotPolicy
passivationPolicyPassivationPolicy

Returns

EntityFac<obj>

InitActorWithRunner

ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)
Member
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.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
runnerFunc<obj, Task<obj>>
snapshotPolicySnapshotPolicy

Returns

EntityFac<obj>

InitAggregate

ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy)
Member
InitAggregate with explicit per-aggregate snapshot and idle-passivation policies.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
snapshotPolicySnapshotPolicy
passivationPolicyPassivationPolicy

Returns

AggregateRefs<'TCommand, 'TEvent>

InitAggregate

ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)
Member
InitAggregate with an explicit per-aggregate snapshot policy.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
snapshotPolicySnapshotPolicy

Returns

AggregateRefs<'TCommand, 'TEvent>

InitAggregate

ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent)
Member
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.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>

Returns

AggregateRefs<'TCommand, 'TEvent>

InitAggregateWithEffects

ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy)
Member
InitAggregateWithEffects with an explicit idle-passivation policy.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
runnerFunc<obj, Task<obj>>
snapshotPolicySnapshotPolicy
passivationPolicyPassivationPolicy

Returns

AggregateRefs<'TCommand, 'TEvent>

InitAggregateWithEffects

ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy)
Member
InitAggregate whose decide can return `EventActions.Dispatch(...)`. See InitActorWithRunner. Returns Factory + Handler like InitAggregate.

Parameters

NameTypeDescription
actorIActor
initialState'TState
entityNamestring
handleCommandFunc<Command<'TCommand>, 'TState, EventAction<'TEvent>>
applyEventFunc<Event<'TEvent>, 'TState, 'TState>
runnerFunc<obj, Task<obj>>
snapshotPolicySnapshotPolicy

Returns

AggregateRefs<'TCommand, 'TEvent>

InitSagaStarter

ActorWiring.InitSagaStarter(actor, eventHandler)
Member
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.

Parameters

NameTypeDescription
actorIActor
eventHandlerFunc<obj, IList<SagaDefinition>>

Returns

unit

InitSagaStarterEmpty

ActorWiring.InitSagaStarterEmpty(actor)
Member
Static helper for C# where extension may not resolve

Parameters

NameTypeDescription
actorIActor

Returns

unit

InitSagaStarterSimple

ActorWiring.InitSagaStarterSimple(actor, eventHandler)
Member
C#-friendly simplified InitializeSagaStarter where you just return factories. A null list means "no sagas"; a null factory fails with a named error.

Parameters

NameTypeDescription
actorIActor
eventHandlerFunc<obj, IList<AggregateFactory>>

Returns

unit

InitializeSagaStarterEmpty

ActorWiring.InitializeSagaStarterEmpty(actor)
Member
Initialize saga starter with no sagas (for simple scenarios)

Parameters

NameTypeDescription
actorIActor

Returns

unit

SendCommandAsync

ActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter)
Member
Send a command and wait for the event (C# friendly)

Parameters

NameTypeDescription
actorIActor
entityFactoryAggregateFactory
cidCID
aggregateIdAggregateId
command'TCommand
filterFunc<'TEvent, bool>

Returns

Task<Event<'TEvent>>

SendIfVersionAsync

ActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter, cancellationToken)
Member
Send a conditional command with cancellation of the caller's wait. An already-canceled token prevents starting the request. Once started, cancellation does not undo processing. A mismatch faults with AggregateVersionConflictException independently of the event filter.

Parameters

NameTypeDescription
actorIActor
entityFactoryAggregateFactory
expectedVersionint64
cidCID
aggregateIdAggregateId
command'TCommand
filterFunc<'TEvent, bool>
cancellationTokenCancellationToken

Returns

Task<Event<'TEvent>>

SendIfVersionAsync

ActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter)
Member
Send only when the aggregate's persisted version equals expectedVersion (initially zero). A mismatch faults with AggregateVersionConflictException before the handler or filter runs. The check and handler run in one actor turn. Deferred replies do not advance the version; persisted batches advance it per event. Stash and RunAsync continuations recheck the version. This does not deduplicate commands or wait for a projection. A timeout does not undo a write. A caller-built PublishEvent reply must retain the incoming command's Id and CorrelationId.

Parameters

NameTypeDescription
actorIActor
entityFactoryAggregateFactory
expectedVersionint64
cidCID
aggregateIdAggregateId
command'TCommand
filterFunc<'TEvent, bool>

Returns

Task<Event<'TEvent>>

WithEventUpcaster

ActorWiring.WithEventUpcaster(actor, convert)
Member
Register a deterministic, one-to-one historical event conversion for this actor system. Register every conversion before initializing any aggregate, saga, or projection. Chains follow the envelope's declared payload type; duplicate sources and cycles are rejected. Applies during FCQRS journal recovery and projection reads. Envelope metadata and stored bytes are preserved; live messages and application-owned snapshot state are not converted. Keep historical payload types readable. A converter must not return null. Converters may run concurrently across consumers and must be thread-safe.

Parameters

NameTypeDescription
actorIActor
convertFunc<'Old, 'New>

Returns

IActor