private void DeleteIfCmd(DeleteIf cmd) { // aggregator var agg = Context.ActorOf(Props.Create(() => new AggregateActor()), AggregateActor.GetUniqueName()); // active ids agg.Tell(new AggregateActor.GetIf(Sender, cmd, State.IdsActive.Count, typeof(DeleteIf_ItemSuccess), typeof(DeleteIf_ItemNoMatch), 10, false)); 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, typeof(DeleteIf_ItemSuccess), typeof(DeleteIf_ItemNoMatch), 10, false)); 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 <DeleteIf>(cmd))); } }
private void DeleteIfCmd(DeleteIf cmd) { CreateRequest(cmd, new EntityTypeActor.DeleteIf(typeof(IDataType), GetGeneralPredicate(cmd.Predicate))); }