IActorType
PackageFCQRS
Defines the core functionalities and context provided by the FCQRS environment to actors.
This interface provides access to essential Akka.NET services and FCQRS initialization methods.
Specification
Kind
Type
Members
14
Examples
0
CreateCommandSubscriptionSignature
this.CreateCommandSubscription
InitializeActorSignature
this.InitializeActor
InitializeActorWithRunnerSignature
this.InitializeActorWithRunner
InitializeSagaSignature
this.InitializeSaga
InitializeSagaStarterSignature
this.InitializeSagaStarter
Summary
| Name | Signature | Synopsis |
|---|---|---|
| CreateCommandSubscription | this.CreateCommandSubscription | Creates a command subscription to wait for a specific event from a target actor. |
| InitializeActor | this.InitializeActor | Initializes a sharded, persistent aggregate actor. |
| InitializeActorWithRunner | this.InitializeActorWithRunner | Like InitializeActor, plus a runner for the `RunAsync` effect: it maps a boxed effect description to a boxed command (self-dispatched, re-entering decide). |
| InitializeSaga | this.InitializeSaga | Initializes a sharded, persistent saga actor. |
| InitializeSagaStarter | this.InitializeSagaStarter | Simplified saga starter where you just return factories. |
| InitializeSagaStarter | this.InitializeSagaStarter | Registers the start rules: which sagas each stored event starts. |
| Stop | this.Stop | Stops the actor system gracefully. |
| SubscribeForCommand | this.SubscribeForCommand | Subscribes to the result of a command sent to another actor. |
| Configuration | this.Configuration | Gets the configuration. |
| System | this.System | Gets the hosting ActorSystem. |
| LoggerFactory | this.LoggerFactory | Gets the logger factory. |
| Materializer | this.Materializer | Gets the Akka Streams materializer. |
| TimeProvider | this.TimeProvider | Gets the time provider. |
| Mediator | this.Mediator | Gets the reference to the distributed pub/sub mediator actor. |
Creates a command subscription to wait for a specific event from a target actor.
Sends the command and asynchronously returns the first matching event received.
If no matching event arrives within `akka.fcqrs.command-timeout` (default
30s) — e.g. the aggregate decided UnhandledEvent/IgnoreEvent or the filter
never matches — the returned Async raises TimeoutException instead of
hanging forever. If the actor system stops first, it raises
OperationCanceledException; the command may or may not have been applied.
<param name="factory">Entity factory function for the target actor type.</param>
<param name="cid">Correlation ID for tracking.</param>
<param name="id">Entity ID of the target actor.</param>
<param name="command">The command payload to send.</param>
<param name="filter">A predicate function to select the desired event.</param>
<param name="metadata">Optional metadata to include with the command.</param>
<returns>An async computation yielding the target event.</returns>
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | string -> IEntityRef<obj> | |
| arg1 | CID | |
| arg2 | AggregateId | |
| arg3 | 'b | |
| arg4 | 'c -> bool | |
| arg5 | Map<string, string> option |
Returns
Async<Event<'c>>
Initializes a sharded, persistent aggregate actor.
<param name="cfg">Environment configuration (IConfiguration & ILoggerFactory).</param>
<param name="initialState">The initial state for new aggregate instances.</param>
<param name="name">The shard type name for this aggregate.</param>
<param name="handleCommand">The command handler function: `Command -> State -> EventAction`.</param>
<param name="apply">The event handler function: `Event -> State -> State`.</param>
<param name="snapshotPolicy">Snapshot cadence for this aggregate.</param>
<param name="passivationPolicy">Idle passivation for this aggregate; `Default` defers to configuration.</param>
<returns>An entity factory (`EntityFac<obj>`) for creating instances of this actor.</returns>
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | 'a | |
| arg1 | string | |
| arg2 | Command<'c> -> 'a -> EventAction<'b> | |
| arg3 | Event<'b> -> 'a -> 'a | |
| arg4 | SnapshotPolicy | |
| arg5 | PassivationPolicy |
Returns
EntityFac<obj>
Like InitializeActor, plus a runner for the `RunAsync` effect: it maps a
boxed effect description to a boxed command (self-dispatched, re-entering
decide). None means the aggregate does not use RunAsync (and using it
fail-fasts). The runner must be total (map failure to a command).
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | 'a | |
| arg1 | string | |
| arg2 | Command<'c> -> 'a -> EventAction<'b> | |
| arg3 | Event<'b> -> 'a -> 'a | |
| arg4 | SnapshotPolicy | |
| arg5 | PassivationPolicy | |
| arg6 | (obj -> Async<obj>) option |
Returns
EntityFac<obj>
Initializes a sharded, persistent saga actor.
<param name="initialState">The initial state (`SagaState`) for new saga instances.</param>
<param name="handleEvent">The event handler function: `Event -> SagaState -> EventAction`.</param>
<param name="applySideEffects">Function determining side effects based on state transitions: `SagaState -> Option<StartingEvent> -> bool -> SagaTransition<NewState> * ExecuteCommand list`. CONTRACT: it must be idempotent for the same state — the framework invokes it on every state entry, on recovery re-drives, and (for this raw API) again when the start handshake acknowledges, so issued commands must be retry-safe. The SagaBuilder facade absorbs the extra invocations by returning Stay; raw sagas must do it themselves.</param>
<param name="applyStateChange">Function to apply internal state changes: `SagaState -> SagaState`.</param>
<param name="name">The shard type name for this saga.</param>
<returns>An entity factory (`EntityFac<obj>`) for creating instances of this saga.</returns>
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | SagaState<'SagaState, 'State> | |
| arg1 | obj -> SagaState<'SagaState, 'State> -> EventAction<'State> | |
| arg2 | SagaState<'SagaState, 'State> -> SagaStartingEvent<Event<'c>> option -> bool -> SagaTransition<'State> * ExecuteCommand list | |
| arg3 | SagaState<'SagaState, 'State> -> SagaState<'SagaState, 'State> | |
| arg4 | string | |
| arg5 | SnapshotPolicy |
Returns
EntityFac<obj>
Simplified saga starter where you just return factories.
Uses default PrefixConversion (identity) and passes through the original event.
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | obj -> (string -> IEntityRef<obj>) list |
Returns
unit
Registers the start rules: which sagas each stored event starts. Call it once, after
registering the aggregates and sagas, with an empty rule when there are no sagas.
<param name="eventHandler">A function mapping a received event object to a list of saga definitions to start: `obj -> list<(Factory * Prefix * StartingEvent)>`.</param>
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | obj -> ((string -> IEntityRef<obj>) * PrefixConversion * obj) list |
Returns
unit
Subscribes to the result of a command sent to another actor.
Parameters
| Name | Type | Description |
|---|---|---|
| arg0 | Command<'a, 'b> |
Returns
Async<Event<'b>>