public ActorProcessConfiguration(ActorId id, Func <IActor> actorFactory, ICanPost parent, ActorType type) { Id = id; ActorFactory = actorFactory; Parent = parent; Type = type; }
public IActorProcess Add(Func <IActor> actorFactory, string adress, ICanPost parent) { var id = NextId(adress, ActorType.Remote); var configuration = new ActorProcessConfiguration(id, actorFactory, parent, id.Type, new Uri(adress)); return(AddInternal <IRemoteActorProcess>(configuration)); }
public IActorProcess Add(Func <IActor> actorFactory, ICanPost parent) { var id = NextId(null, ActorType.Transient); var configuration = new ActorProcessConfiguration(id, actorFactory, parent, id.Type); return(AddInternal <IActorProcess>(configuration)); }
public MessageContext(IActorProcess actor, IEvent message, ICanPost sender, IActorRegistry actorRegistry) { Actor = actor; Message = message; Sender = sender; Registry = actorRegistry; }
private void EnsureCanSend(ICanPost target) { if (target.Id.Type == ActorType.Remote && _actorProcess.Id.Type == ActorType.Transient) { throw new Exception("cannot send from transient to remote"); } }
public IActorProcess Add(Func <IActor> actorFactory, string adress, ICanPost parent, string name) { var process = _registry.Add(actorFactory, adress, parent, name); _directory.Register(new ClusterMember(process.Id)); return(process); }
public RemoteWriterService(ICanPost remote, ISerializer serializer) { var uri = new Uri(remote.Id.Adress); _channel = new Channel($"{uri.Host}:{uri.Port}", ChannelCredentials.Insecure); _client = new Transport.TransportClient(_channel); _serializer = serializer; }
private MessageEnvelope Serialize(IEvent message, ICanPost sender) { return(new MessageEnvelope() { MessageData = ByteString.FromStream(new MemoryStream(_serializer.Serialize(message))), MessageType = message.GetType().ToString(), Sender = sender?.Id.ToPid() }); }
public IActorProcess Add(Func <IActor> actorFactory, string adress, ICanPost parent, string name) { if (_actors.ContainsKey(name)) { throw new Exception("already exist"); } var id = NextId(name, adress, ActorType.Remote); var configuration = new ActorProcessConfiguration(id, actorFactory, parent, id.Type); return(AddInternal <IActorProcess>(configuration)); }
public void Post(IEvent msg, ICanPost sender) { var context = new MessageContext(_process, msg, sender, _registry); _messages.Add(context); }
public void Post(IEvent msg, ICanPost sender) { _mailbox.Post(msg, sender); }
public IActorProcess Add(Func <IActor> actorFactory, ICanPost parent) { return(_registry.Add(actorFactory, parent)); }
public void Write(ICommand message, ICanPost sender, TimeSpan timeout) { _client.Send(Serialize(message, sender), deadline: DateTime.Now.Add(timeout)); }
public void Write(ICommand message, ICanPost sender, CancellationToken cancellationToken) { _client.Send(Serialize(message, sender), cancellationToken: cancellationToken); }
public void Write(IEvent message, ICanPost sender) { _client.Send(Serialize(message, sender)); }
public void Post(IEvent msg, ICanPost sender) { _writer.Write(msg, sender); }