Ejemplo n.º 1
0
        private void GetIfCmd(GetIf cmd, bool firstExecution)
        {
            if (firstExecution)
            {
                Owner                = Sender;
                Requestor            = cmd.Requestor;
                OriginalCommand      = cmd.OriginalCommand;
                TargetCount          = cmd.TargetCount;
                RemainingCount       = cmd.TargetCount;
                Targets              = cmd.Targets;
                TargetCommand        = cmd.TargetCommand;
                ExpectedResponseType = cmd.ExpectedResponseType;
                NoMatchResponseType  = cmd.NoMatchResponseType;
                TimeoutSeconds       = cmd.TimeoutSeconds;
                TellRequestor        = cmd.TellRequestor;

                GetIfMsg = cmd;

                Become(Aggregating);
            }
            else
            {
                TargetCount    += cmd.TargetCount;
                RemainingCount += cmd.TargetCount;
            }
        }
Ejemplo n.º 2
0
        private void GetIfCmd(GetIf cmd)
        {
            // aggregator
            var agg = Context.ActorOf(Props.Create(() => new AggregateActor()), AggregateActor.GetUniqueName());

            // active ids
            agg.Tell(new AggregateActor.GetIf(Sender, cmd, State.IdsActive.Count, State.Type, typeof(GetIf_NoMatch)));
            foreach (var activeId in State.IdsActive)
            {
                var child = Context.Child(activeId);
                if (child != ActorRefs.Nobody)
                {
                    agg.Tell(new AggregateActor.GetIfAdd(child, cmd));
                }
                else
                {
                    agg.Tell(new AggregateActor.ReduceTargetCount());
                }
            }
            // inactive ids
            agg.Tell(new AggregateActor.GetIf(Sender, cmd, State.IdsInactive.Count, State.Type, typeof(GetIf_NoMatch)));
            foreach (var inactiveId in State.IdsInactive)
            {
                var child = Context.Child(inactiveId);
                if (child == ActorRefs.Nobody)
                {
                    child = CreateEntity(inactiveId);
                }

                // get inactive data and deactivate child once it replies
                agg.Tell(new AggregateActor.GetIfAdd(child, new EntityActor.DeactivateAfter <GetIf>(cmd)));
            }
        }
Ejemplo n.º 3
0
 public GetIfCompletedEvnt(GetIf cmd, IEnumerable <object> results)
 {
     Cmd     = cmd;
     Results = results;
 }
Ejemplo n.º 4
0
 private void GetIfCmd(GetIf cmd)
 {
     CreateRequest(cmd, new EntityTypeActor.GetIf(typeof(IDataType), GetGeneralPredicate(cmd.Predicate)));
 }