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
| Name | Signature | Synopsis |
|---|---|---|
| CreateCommand | ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter) | C#-friendly CreateCommandSubscription that returns FSharpAsync (for use with Handler delegate) |
| InitActor | ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy) | InitActor with explicit per-aggregate snapshot and idle-passivation policies. |
| InitActor | ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy) | InitActor with an explicit per-aggregate snapshot policy. |
| InitActor | ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent) | C#-friendly InitializeActor that accepts Func delegates instead of F# functions |
| InitActorWithRunner | ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy) | InitActorWithRunner with an explicit idle-passivation policy. |
| InitActorWithRunner | ActorWiring.InitActorWithRunner(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy) | InitActor whose decide can return `EventActions.Dispatch(...)` (the RunAsync effect). |
| InitAggregate | ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy, passivationPolicy) | InitAggregate with explicit per-aggregate snapshot and idle-passivation policies. |
| InitAggregate | ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy) | InitAggregate with an explicit per-aggregate snapshot policy. |
| InitAggregate | ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent) | One-call aggregate wiring: registers the aggregate (sharding region) and returns its Factory + Handler. |
| InitAggregateWithEffects | ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy, passivationPolicy) | InitAggregateWithEffects with an explicit idle-passivation policy. |
| InitAggregateWithEffects | ActorWiring.InitAggregateWithEffects(actor, initialState, entityName, handleCommand, applyEvent, runner, snapshotPolicy) | InitAggregate whose decide can return `EventActions.Dispatch(...)`. |
| InitSagaStarter | ActorWiring.InitSagaStarter(actor, eventHandler) | C#-friendly InitializeSagaStarter that accepts Func returning IList of SagaDefinition. |
| InitSagaStarterEmpty | ActorWiring.InitSagaStarterEmpty(actor) | Static helper for C# where extension may not resolve |
| InitSagaStarterSimple | ActorWiring.InitSagaStarterSimple(actor, eventHandler) | C#-friendly simplified InitializeSagaStarter where you just return factories. |
| InitializeSagaStarterEmpty | ActorWiring.InitializeSagaStarterEmpty(actor) | Initialize saga starter with no sagas (for simple scenarios) |
| SendCommandAsync | ActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter) | Send a command and wait for the event (C# friendly) |
| SendIfVersionAsync | ActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter, cancellationToken) | Send a conditional command with cancellation of the caller's wait. |
| SendIfVersionAsync | ActorWiring.SendIfVersionAsync(actor, entityFactory, expectedVersion, cid, aggregateId, command, filter) | Send only when the aggregate's persisted version equals expectedVersion (initially zero). |
| WithEventUpcaster | ActorWiring.WithEventUpcaster(actor, convert) | Register a deterministic, one-to-one historical event conversion for this actor system. |
ActorWiring.CreateCommand(actor, entityFactory, cid, aggregateId, command, filter)
Member
C#-friendly CreateCommandSubscription that returns FSharpAsync (for use with Handler delegate)
Parameters
| Name | Type | Description |
|---|---|---|
| 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, passivationPolicy)
Member
InitActor with explicit per-aggregate snapshot and idle-passivation policies.
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| initialState | 'TState | |
| entityName | string | |
| handleCommand | Func<Command<'TCommand>, 'TState, EventAction<'TEvent>> | |
| applyEvent | Func<Event<'TEvent>, 'TState, 'TState> | |
| snapshotPolicy | SnapshotPolicy | |
| passivationPolicy | PassivationPolicy |
Returns
EntityFac<obj>
ActorWiring.InitActor(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)
Member
InitActor with an explicit per-aggregate snapshot policy.
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| initialState | 'TState | |
| entityName | string | |
| handleCommand | Func<Command<'TCommand>, 'TState, EventAction<'TEvent>> | |
| applyEvent | Func<Event<'TEvent>, 'TState, 'TState> | |
| snapshotPolicy | SnapshotPolicy |
Returns
EntityFac<obj>
C#-friendly InitializeActor that accepts Func delegates instead of F# functions
Parameters
| Name | Type | Description |
|---|---|---|
| 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, 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
| Name | Type | Description |
|---|---|---|
| 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 | |
| passivationPolicy | PassivationPolicy |
Returns
EntityFac<obj>
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
| Name | Type | Description |
|---|---|---|
| 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, passivationPolicy)
Member
InitAggregate with explicit per-aggregate snapshot and idle-passivation policies.
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| initialState | 'TState | |
| entityName | string | |
| handleCommand | Func<Command<'TCommand>, 'TState, EventAction<'TEvent>> | |
| applyEvent | Func<Event<'TEvent>, 'TState, 'TState> | |
| snapshotPolicy | SnapshotPolicy | |
| passivationPolicy | PassivationPolicy |
Returns
AggregateRefs<'TCommand, 'TEvent>
ActorWiring.InitAggregate(actor, initialState, entityName, handleCommand, applyEvent, snapshotPolicy)
Member
InitAggregate with an explicit per-aggregate snapshot policy.
Parameters
| Name | Type | Description |
|---|---|---|
| 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)
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
| Name | Type | Description |
|---|---|---|
| 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, passivationPolicy)
Member
InitAggregateWithEffects with an explicit idle-passivation policy.
Parameters
| Name | Type | Description |
|---|---|---|
| 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 | |
| passivationPolicy | PassivationPolicy |
Returns
AggregateRefs<'TCommand, 'TEvent>
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
| Name | Type | Description |
|---|---|---|
| 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>
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
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| eventHandler | Func<obj, IList<SagaDefinition>> |
Returns
unit
Static helper for C# where extension may not resolve
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor |
Returns
unit
C#-friendly simplified InitializeSagaStarter where you just return factories.
A null list means "no sagas"; a null factory fails with a named error.
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| eventHandler | Func<obj, IList<AggregateFactory>> |
Returns
unit
Initialize saga starter with no sagas (for simple scenarios)
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor |
Returns
unit
ActorWiring.SendCommandAsync(actor, entityFactory, cid, aggregateId, command, filter)
Member
Send a command and wait for the event (C# friendly)
Parameters
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| entityFactory | AggregateFactory | |
| cid | CID | |
| aggregateId | AggregateId | |
| command | 'TCommand | |
| filter | Func<'TEvent, bool> |
Returns
Task<Event<'TEvent>>
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
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| entityFactory | AggregateFactory | |
| expectedVersion | int64 | |
| cid | CID | |
| aggregateId | AggregateId | |
| command | 'TCommand | |
| filter | Func<'TEvent, bool> | |
| cancellationToken | CancellationToken |
Returns
Task<Event<'TEvent>>
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
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| entityFactory | AggregateFactory | |
| expectedVersion | int64 | |
| cid | CID | |
| aggregateId | AggregateId | |
| command | 'TCommand | |
| filter | Func<'TEvent, bool> |
Returns
Task<Event<'TEvent>>
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
| Name | Type | Description |
|---|---|---|
| actor | IActor | |
| convert | Func<'Old, 'New> |
Returns
IActor