Class AkkaSaga<TAuthenticationToken>
A ISaga<TAuthenticationToken> that is safe to use within Akka.NET
Inheritance
Inherited Members
Namespace: Cqrs.Akka.Domain
Assembly: Cqrs.Akka.dll
Syntax
public abstract class AkkaSaga<TAuthenticationToken> : ReceiveActor, IInternalActor, IInitializableActor, ISaga<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of authentication token. |
Constructors
AkkaSaga(ISagaUnitOfWork<TAuthenticationToken>, ILogger, IAkkaSagaRepository<TAuthenticationToken>, ICorrelationIdHelper, IAuthenticationTokenHelper<TAuthenticationToken>, ICommandPublisher<TAuthenticationToken>)
Instantiates a new instance of AkkaSaga<TAuthenticationToken>
Declaration
protected AkkaSaga(ISagaUnitOfWork<TAuthenticationToken> unitOfWork, ILogger logger, IAkkaSagaRepository<TAuthenticationToken> repository, ICorrelationIdHelper correlationIdHelper, IAuthenticationTokenHelper<TAuthenticationToken> authenticationTokenHelper, ICommandPublisher<TAuthenticationToken> commandPublisher)
Parameters
Type | Name | Description |
---|---|---|
ISagaUnitOfWork<TAuthenticationToken> | unitOfWork | |
cdmdotnet.Logging.ILogger | logger | |
IAkkaSagaRepository<TAuthenticationToken> | repository | |
cdmdotnet.Logging.ICorrelationIdHelper | correlationIdHelper | |
IAuthenticationTokenHelper<TAuthenticationToken> | authenticationTokenHelper | |
ICommandPublisher<TAuthenticationToken> | commandPublisher |
Properties
AuthenticationTokenHelper
Gets or sets the IAuthenticationTokenHelper<TAuthenticationToken>.
Declaration
protected IAuthenticationTokenHelper<TAuthenticationToken> AuthenticationTokenHelper { get; set; }
Property Value
Type | Description |
---|---|
IAuthenticationTokenHelper<TAuthenticationToken> |
CommandPublisher
Gets or sets the ICommandPublisher<TAuthenticationToken>.
Declaration
protected ICommandPublisher<TAuthenticationToken> CommandPublisher { get; set; }
Property Value
Type | Description |
---|---|
ICommandPublisher<TAuthenticationToken> |
CorrelationIdHelper
Gets or sets the cdmdotnet.Logging.ICorrelationIdHelper.
Declaration
protected ICorrelationIdHelper CorrelationIdHelper { get; set; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ICorrelationIdHelper |
Id
The identifier of the ISaga<TAuthenticationToken>.
Declaration
public Guid Id { get; protected set; }
Property Value
Type | Description |
---|---|
System.Guid |
Implements
Logger
Gets or sets the cdmdotnet.Logging.ILogger.
Declaration
protected ILogger Logger { get; set; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
Repository
Gets or sets the IAkkaSagaRepository<TAuthenticationToken>.
Declaration
protected IAkkaSagaRepository<TAuthenticationToken> Repository { get; set; }
Property Value
Type | Description |
---|---|
IAkkaSagaRepository<TAuthenticationToken> |
UnitOfWork
Gets or sets the ISagaUnitOfWork<TAuthenticationToken>.
Declaration
protected ISagaUnitOfWork<TAuthenticationToken> UnitOfWork { get; set; }
Property Value
Type | Description |
---|---|
ISagaUnitOfWork<TAuthenticationToken> |
Version
The current version of this ISaga<TAuthenticationToken>.
Declaration
public int Version { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
Methods
Apply(ISagaEvent<TAuthenticationToken>)
Dynamically calls the "Apply" method, passing it the Event of the provided sagaEvent
.
Declaration
protected virtual void Apply(ISagaEvent<TAuthenticationToken> sagaEvent)
Parameters
Type | Name | Description |
---|---|---|
ISagaEvent<TAuthenticationToken> | sagaEvent |
ApplyChange(IEvent<TAuthenticationToken>)
Declaration
protected virtual void ApplyChange(IEvent<TAuthenticationToken> event)
Parameters
Type | Name | Description |
---|---|---|
IEvent<TAuthenticationToken> | event |
ApplyChange(ISagaEvent<TAuthenticationToken>)
Call the "Apply" method with a signature matching the provided event
without using event replay to this instance.
Declaration
protected virtual void ApplyChange(ISagaEvent<TAuthenticationToken> event)
Parameters
Type | Name | Description |
---|---|---|
ISagaEvent<TAuthenticationToken> | event |
Remarks
This means a method named "Apply", with return type void and one parameter must exist to be applied.
If no method exists, nothing is applied
The parameter type must match exactly the System.Type of the provided event
.
Execute<TEvent>(Action<TEvent>, TEvent)
Executes the provided action
passing it the provided event
,
then calls PublishEvent(IEvent<TAuthenticationToken>)
Declaration
protected virtual void Execute<TEvent>(Action<TEvent> action, TEvent event)where TEvent : IEvent<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
System.Action<TEvent> | action | |
TEvent | event |
Type Parameters
Name | Description |
---|---|
TEvent |
GetUncommittedChanges()
Get all applied changes that haven't yet been committed.
Declaration
public IEnumerable<ISagaEvent<TAuthenticationToken>> GetUncommittedChanges()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISagaEvent<TAuthenticationToken>> |
Implements
LoadFromHistory(IEnumerable<ISagaEvent<TAuthenticationToken>>)
Apply all the IEvent<TAuthenticationToken> in history
using event replay to this instance.
Declaration
public virtual void LoadFromHistory(IEnumerable<ISagaEvent<TAuthenticationToken>> history)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISagaEvent<TAuthenticationToken>> | history |
Implements
MarkChangesAsCommitted()
Mark all applied changes as committed, increment Version and flush the internal collection of changes.
Declaration
public virtual void MarkChangesAsCommitted()
Implements
PreStart()
User overridable callback.
Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
Declaration
protected override void PreStart()
Overrides
SetId(ISagaEvent<TAuthenticationToken>)
Declaration
protected virtual void SetId(ISagaEvent<TAuthenticationToken> sagaEvent)
Parameters
Type | Name | Description |
---|---|---|
ISagaEvent<TAuthenticationToken> | sagaEvent |