Class ConcurrentAkkaCommandPublisher<TAuthenticationToken, TTarget>
A IAkkaCommandPublisher<TAuthenticationToken> that ensure concurrency regardless of what it passes the command onto as it is a Akka.Actor.ReceiveActor
Inheritance
Inherited Members
Namespace: Cqrs.Akka.Commands
Assembly: Cqrs.Akka.dll
Syntax
public class ConcurrentAkkaCommandPublisher<TAuthenticationToken, TTarget> : ReceiveActor, IInternalActor, IInitializableActor, IConcurrentAkkaCommandPublisher<TAuthenticationToken, TTarget>, IConcurrentAkkaCommandPublisher<TAuthenticationToken>, IAkkaCommandPublisher<TAuthenticationToken>, IPublishAndWaitCommandPublisher<TAuthenticationToken>, ICommandPublisher<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of the authentication token. |
TTarget | The System.Type of the object that is targeted that needs concurrency. |
Constructors
ConcurrentAkkaCommandPublisher(IActorRef, ICommandReceiver<TAuthenticationToken>)
Instantiates a new instance of ConcurrentAkkaCommandPublisher<TAuthenticationToken, TTarget>.
Declaration
public ConcurrentAkkaCommandPublisher(IActorRef actorReference, ICommandReceiver<TAuthenticationToken> commandReceiver)
Parameters
Type | Name | Description |
---|---|---|
Akka.Actor.IActorRef | actorReference | |
ICommandReceiver<TAuthenticationToken> | commandReceiver |
Properties
ActorReference
Gets the Akka.Actor.IActorRef.
Declaration
protected IActorRef ActorReference { get; }
Property Value
Type | Description |
---|---|
Akka.Actor.IActorRef |
CommandReceiver
Gets the ICommandReceiver<TAuthenticationToken>.
Declaration
protected ICommandReceiver<TAuthenticationToken> CommandReceiver { get; }
Property Value
Type | Description |
---|---|
ICommandReceiver<TAuthenticationToken> |
Methods
Publish<TCommand>(TCommand)
Publishes the provided command
on the CommandReceiver.
Declaration
public void Publish<TCommand>(TCommand command)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command |
Type Parameters
Name | Description |
---|---|
TCommand |
Implements
Remarks
This is for when a command originated outside Akka and now needs to be pushed into Akka.
Publish<TCommand>(IEnumerable<TCommand>)
Publishes the provided commands
on the CommandReceiver.
Declaration
public void Publish<TCommand>(IEnumerable<TCommand> commands)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TCommand> | commands |
Type Parameters
Name | Description |
---|---|
TCommand |
Implements
Remarks
This is for when a command originated outside Akka and now needs to be pushed into Akka.
PublishAndWait<TCommand, TEvent>(TCommand, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits for an event of TEvent
Declaration
public virtual TEvent PublishAndWait<TCommand, TEvent>(TCommand command, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |
Implements
PublishAndWait<TCommand, TEvent>(TCommand, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent>, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits until the specified condition is satisfied an event of TEvent
Declaration
public TEvent PublishAndWait<TCommand, TEvent>(TCommand command, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent> condition, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
System.Func<System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>>, TEvent> | condition | A delegate to be executed over and over until it returns the |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |
Implements
PublishAndWait<TCommand, TEvent>(TCommand, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent>, Int32, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits for an event of TEvent
or exits if the specified timeout is expired.
Declaration
public TEvent PublishAndWait<TCommand, TEvent>(TCommand command, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent> condition, int millisecondsTimeout, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
System.Func<System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>>, TEvent> | condition | A delegate to be executed over and over until it returns the |
System.Int32 | millisecondsTimeout | The number of milliseconds to wait, or System.Threading.Timeout.Infinite (-1) to wait indefinitely. |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |
Implements
PublishAndWait<TCommand, TEvent>(TCommand, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent>, TimeSpan, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits for an event of TEvent
or exits if the specified timeout is expired.
Declaration
public TEvent PublishAndWait<TCommand, TEvent>(TCommand command, Func<IEnumerable<IEvent<TAuthenticationToken>>, TEvent> condition, TimeSpan timeout, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
System.Func<System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>>, TEvent> | condition | A delegate to be executed over and over until it returns the |
System.TimeSpan | timeout | A System.TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |
Implements
PublishAndWait<TCommand, TEvent>(TCommand, Int32, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits for an event of TEvent
or exits if the specified timeout is expired.
Declaration
public TEvent PublishAndWait<TCommand, TEvent>(TCommand command, int millisecondsTimeout, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
System.Int32 | millisecondsTimeout | The number of milliseconds to wait, or System.Threading.Timeout.Infinite (-1) to wait indefinitely. |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |
Implements
PublishAndWait<TCommand, TEvent>(TCommand, TimeSpan, IEventReceiver<TAuthenticationToken>)
Publishes the provided command
and waits for an event of TEvent
or exits if the specified timeout is expired.
Declaration
public TEvent PublishAndWait<TCommand, TEvent>(TCommand command, TimeSpan timeout, IEventReceiver<TAuthenticationToken> eventReceiver = null)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The |
System.TimeSpan | timeout | A System.TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. |
IEventReceiver<TAuthenticationToken> | eventReceiver | If provided, is the IEventReceiver<TAuthenticationToken> that the event is expected to be returned on. |
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TCommand | |
TEvent |