Line data Source code
1 : using System;
2 : using Akka.Actor;
3 : using Cqrs.Akka.Domain;
4 : using Cqrs.Akka.Tests.Unit.Aggregates;
5 : using Cqrs.Commands;
6 :
7 : namespace Cqrs.Akka.Tests.Unit.Commands.Handlers
8 : {
9 : public class SayHelloWorldCommandHandler
10 : : ICommandHandler<Guid, SayHelloWorldCommand>
11 0 : {
12 : /// <summary>
13 : /// Instantiates the <see cref="SayHelloWorldCommandHandler"/> class registering any <see cref="ReceiveActor.Receive{T}(System.Func{T,System.Threading.Tasks.Task})"/> required.
14 : /// </summary>
15 1 : public SayHelloWorldCommandHandler(IAkkaAggregateResolver aggregateResolver)
16 : {
17 : AggregateResolver = aggregateResolver;
18 : }
19 :
20 : protected IAkkaAggregateResolver AggregateResolver { get; private set; }
21 :
22 : #region Implementation of IMessageHandler<in SayHelloWorldCommand>
23 :
24 0 : public void Handle(SayHelloWorldCommand command)
25 : {
26 : if (command.Id == Guid.Empty)
27 : command.Id = Guid.NewGuid();
28 : IActorRef item = AggregateResolver.ResolveActor<HelloWorld, Guid>(command.Id);
29 : bool result = item.Ask<bool>(command).Result;
30 : // item.Tell(parameters);
31 : }
32 :
33 : #endregion
34 : }
35 : }
|