public async Task ReceiveAsync(IContext context) { switch (context.Message) { case Started _: Console.Out.WriteLine("Started: " + context.Self.Id); Actor.EventStream.Subscribe <ClusterTopologyEvent>(clusterTopologyEvent => { Console.Out.WriteLine("Got inner ClusterTopologyEvent"); context.Self.Tell(clusterTopologyEvent); }); break; case PID brokerPid: _brokers.Add(brokerPid); context.Watch(brokerPid); break; case Terminated terminated: _brokers.Remove(terminated.Who); context.Unwatch(terminated.Who); break; case ClusterTopologyEvent clusterTopologyEvent: Console.Out.WriteLine("clusterTopologyEvent"); _brokers.Clear(); foreach (MemberStatus memberStatus in clusterTopologyEvent.Statuses) { if (memberStatus.Alive) { PID remoteBrokerActorPid = new PID(memberStatus.Address, context.Self.Id); GetPublisherPiDsResponse getPublisherPiDsResponse = await remoteBrokerActorPid .RequestAsync <GetPublisherPiDsResponse>(new GetPublisherPiDs()) .ConfigureAwait(false); } } break; } }
public ProcessNameExistException(string name, PID pid) : base($"a Process with the name '{name}' already exists") { Name = name; Pid = pid; }
public Task <T> RequestAsync <T>(PID target, object message) => RequestAsync(target, message, new FutureProcess <T>());
public Task <T> RequestAsync <T>(PID target, object message, TimeSpan timeout) => RequestAsync(target, message, new FutureProcess <T>(timeout));
public void Send(PID target, object message) => SendUserMessage(target, message);
public void Remove(PID pid) { _localActorRefs.Remove(pid.Id); }
public Failure(PID who, Exception reason, RestartStatistics crs) { Who = who; Reason = reason; RestartStatistics = crs; }
public virtual Task <T> RequestAsync <T>(PID target, object message) => _context.RequestAsync <T>(target, message);
public virtual void Watch(PID pid) => _context.Watch(pid);
public Task <T> RequestAsync <T>(PID target, object message) { throw new NotImplementedException(); }
public Task <T> RequestAsync <T>(PID target, object message, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public void Request(PID target, object message, PID sender) { var envelope = new MessageEnvelope(message, sender, null); Tell(target, envelope); }
private Task DefaultSender(ISenderContext context, PID target, MessageEnvelope message) { target.Tell(message); return(Actor.Done); }
protected internal override void SendUserMessage(PID pid, object message) { throw new InvalidOperationException($"Guardian actor cannot receive any user messages."); }
public void EscalateFailure(Exception reason, PID who) { throw new InvalidOperationException("Guardian cannot escalate failure."); }
public virtual Task <T> RequestAsync <T>(PID target, object message, TimeSpan timeout) => _context.RequestAsync <T>(target, message, timeout);
public virtual Task <T> RequestAsync <T>(PID target, object message, CancellationToken cancellationToken) => _context.RequestAsync <T>(target, message, cancellationToken);
public virtual void Unwatch(PID pid) => _context.Unwatch(pid);
public MessageSender(object message, PID sender) { Message = message; Sender = sender; }
public virtual void Forward(PID target) => _context.Forward(target);
public Unwatch(PID watcher) { Watcher = watcher; }
protected internal abstract void SendUserMessage(PID pid, object message);
public void Unwatch(PID pid) => pid.SendSystemMessage(new Unwatch(Self));
public virtual void Stop(PID pid) { SendSystemMessage(pid, Proto.Stop.Instance); }
public void Request(PID target, object message) { var messageEnvelope = new MessageEnvelope(message, Self, null); SendUserMessage(target, messageEnvelope); }
protected internal abstract void SendSystemMessage(PID pid, object message);
public Task <T> RequestAsync <T>(PID target, object message, CancellationToken cancellationToken) => RequestAsync(target, message, new FutureProcess <T>(cancellationToken));
public virtual void Send(PID target, object message) => _context.Send(target, message);
public void AddChild(PID pid) => Children = Children.Add(pid);
public virtual void Request(PID target, object message) => _context.Request(target, message);