public void Handle(CreateActorRouteMessage msg) { _monitor.IncrementMessagesReceived(); var handleActor = CreateActor(msg.ActorType, CreateActorRouter(msg), msg.ActorName); foreach (var msgRoute in msg.Routes) { Log.Info("Subscribed {actor} to {messageType}", handleActor.Path, msgRoute.MessageType); _subscriber.Subscribe(msgRoute.MessageType, handleActor, Self); } Sender.Tell(RouteCreated.Instance); }
public ExplicitSourcesEventWaiter(IActorRef notifyActor, params Guid[] sources) { _collection = sources; _set = new HashSet <Guid>(_collection); Receive <T>( msg => { _log.Info($"got message:{msg.ToPropsString()} msg left to notify: {_set.Count}"); if (!_set.Contains(msg.SourceId)) { return; } _set.Remove(msg.SourceId); if (_set.Any()) { return; } _log.Info($"got all expected messages, will notify. last message: {msg.ToPropsString()}"); notifyActor.Tell(new ExpectedMessagesRecieved <T>(msg)); }); }