Unit Tell(object message, ProcessId sender, string inbox, Message.Type type) => ProcessHub.Connections.Find(Id).Iter(c => c.Tell( new ClientMessageDTO { tag = inbox, type = type.ToString().ToLower(), connectionId = (string)Id, content = message, contentType = message.GetType().AssemblyQualifiedName, sender = sender.Path, replyTo = sender.Path, requestId = 0, sessionId = SessionId.Map(x => x.ToString()).IfNone(""), to = ProcessId.Skip(3).Path }));
public Option <ActorItem> GetLocalActor(ProcessId pid) { if (pid.System != SystemName) { return(None); } return(GetLocalActor(rootItem, pid.Skip(1), pid)); }
public ActorDispatchJS(ProcessId pid, Option <SessionId> sessionId, bool transactionalIO) { Id = ClientConnectionId.New(pid.Skip(2).Take(1).Name.Value); ProcessHub.Connections.Find(Id).IfNone(() => { throw new ClientDisconnectedException(Id); }); ProcessId = pid; SessionId = sessionId; this.transactionalIO = transactionalIO; }
internal Option <Func <ProcessId, IEnumerable <ProcessId> > > GetProcessSelector(ProcessId pid) { if (pid.Count() < 3) { throw new InvalidProcessIdException("Invalid role Process ID"); } var type = pid.Skip(1).Take(1).Name; return(Dispatch.getFunc(type)); }
Option <ActorItem> GetLocalActor(ActorItem current, ProcessId walk, ProcessId pid) { if (current.Actor.Id == pid) { return(current); } var name = walk.Take(1).Name; return(from child in current.Actor.Children.Find(walk.Take(1).Name.Value) from result in GetLocalActor(child, walk.Skip(1), pid) select result); }
internal IActorDispatch GetPluginDispatcher(ProcessId pid) => GetProcessSelector(pid) .Map(selector => new ActorDispatchGroup(selector(pid.Skip(2)), Settings.TransactionalIO) as IActorDispatch) .IfNone(() => new ActorDispatchNotExist(pid));
internal IEnumerable <ProcessId> ResolveProcessIdSelection(ProcessId pid) => GetProcessSelector(pid) .Map(selector => selector(pid.Skip(2))) .IfNone(() => new ProcessId[0]);
public static IEnumerable <ProcessId> NodeIds(ProcessId leaf) => Nodes(leaf).Values.Map(node => ProcessId.Top[node.NodeName].Append(leaf.Skip(1)));