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

NameSignatureSynopsis
CreateCommandSubscriptionthis.CreateCommandSubscriptionCreates a command subscription to wait for a specific event from a target actor.
InitializeActorthis.InitializeActorInitializes a sharded, persistent aggregate actor.
InitializeActorWithRunnerthis.InitializeActorWithRunnerLike InitializeActor, plus a runner for the `RunAsync` effect: it maps a boxed effect description to a boxed command (self-dispatched, re-entering decide).
InitializeSagathis.InitializeSagaInitializes a sharded, persistent saga actor.
InitializeSagaStarterthis.InitializeSagaStarterSimplified saga starter where you just return factories.
InitializeSagaStarterthis.InitializeSagaStarterInitializes the Saga Starter actor, configuring which events trigger which sagas.
Stopthis.StopStops the actor system gracefully.
SubscribeForCommandthis.SubscribeForCommandSubscribes to the result of a command sent to another actor.
LoggerFactorythis.LoggerFactoryGets the logger factory.
Mediatorthis.MediatorGets the reference to the distributed pub/sub mediator actor.
Systemthis.SystemGets the hosting ActorSystem.
Configurationthis.ConfigurationGets the configuration.
TimeProviderthis.TimeProviderGets the time provider.
Materializerthis.MaterializerGets the Akka Streams materializer.

CreateCommandSubscription

this.CreateCommandSubscription
Member
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. <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

NameTypeDescription
arg0string -> IEntityRef<obj>
arg1CID
arg2AggregateId
arg3'b
arg4'c -> bool
arg5Map<string, string> option

Returns

Async<Event<'c>>

InitializeActor

this.InitializeActor
Member
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

NameTypeDescription
arg0'a
arg1string
arg2Command<'c> -> 'a -> EventAction<'b>
arg3Event<'b> -> 'a -> 'a
arg4SnapshotPolicy
arg5PassivationPolicy

Returns

EntityFac<obj>

InitializeActorWithRunner

this.InitializeActorWithRunner
Member
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

NameTypeDescription
arg0'a
arg1string
arg2Command<'c> -> 'a -> EventAction<'b>
arg3Event<'b> -> 'a -> 'a
arg4SnapshotPolicy
arg5PassivationPolicy
arg6(obj -> Async<obj>) option

Returns

EntityFac<obj>

InitializeSaga

this.InitializeSaga
Member
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

NameTypeDescription
arg0SagaState<'SagaState, 'State>
arg1obj -> SagaState<'SagaState, 'State> -> EventAction<'State>
arg2SagaState<'SagaState, 'State> -> SagaStartingEvent<Event<'c>> option -> bool -> SagaTransition<'State> * ExecuteCommand list
arg3SagaState<'SagaState, 'State> -> SagaState<'SagaState, 'State>
arg4string
arg5SnapshotPolicy

Returns

EntityFac<obj>

InitializeSagaStarter

this.InitializeSagaStarter
Member
Simplified saga starter where you just return factories. Uses default PrefixConversion (identity) and passes through the original event.

Parameters

NameTypeDescription
arg0obj -> (string -> IEntityRef<obj>) list

Returns

unit

InitializeSagaStarter

this.InitializeSagaStarter
Member
Initializes the Saga Starter actor, configuring which events trigger which 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

NameTypeDescription
arg0obj -> ((string -> IEntityRef<obj>) * PrefixConversion * obj) list

Returns

unit

Stop

this.Stop
Member
Stops the actor system gracefully.

Returns

Task

SubscribeForCommand

this.SubscribeForCommand
Member
Subscribes to the result of a command sent to another actor.

Parameters

NameTypeDescription
arg0Command<'a, 'b>

Returns

Async<Event<'b>>

LoggerFactory

this.LoggerFactory
Member
Gets the logger factory.

Returns

ILoggerFactory

Mediator

this.Mediator
Member
Gets the reference to the distributed pub/sub mediator actor.

Returns

IActorRef

System

this.System
Member
Gets the hosting ActorSystem.

Returns

ActorSystem

Configuration

this.Configuration
Member
Gets the configuration.

Returns

IConfiguration

TimeProvider

this.TimeProvider
Member
Gets the time provider.

Returns

TimeProvider

Materializer

this.Materializer
Member
Gets the Akka Streams materializer.

Returns

ActorMaterializer