Unit Tell(object message, ProcessId sender, string inbox, Message.Type type, Message.TagSpec tag) { var dto = RemoteMessageDTO.Create(message, ProcessId, sender, type, tag); // The standard structure for remote js relay paths are "/root/js/{connection-id}/..." var connectionId = ProcessId.Skip(2).Take(1).Name.Value; dto.To = ProcessId.Skip(3).Path; var relayMsg = new OutboundRelayMsg(connectionId, dto, dto.To, sender, dto.RequestId != -1); return(Process.tell(RelayId, relayMsg, sender)); }
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => IterRoleMembers(d => d.Tell(message, sender, tag));
internal static RemoteMessageDTO CreateMessage(object message, ProcessId to, ProcessId sender, Message.Type type, Message.TagSpec tag) => new RemoteMessageDTO { Type = (int)type, Tag = (int)tag, To = to.Path, RequestId = -1, MessageId = Guid.NewGuid(), Sender = sender.ToString(), ReplyTo = sender.ToString(), ContentType = message == null ? null : message.GetType().AssemblyQualifiedName, Content = message == null ? null : JsonConvert.SerializeObject(message, ActorSystemConfig.Default.JsonSerializerSettings) };
internal static RemoteMessageDTO Create(object message, ProcessId to, ProcessId sender, Message.Type type, Message.TagSpec tag) => map(message as ActorRequest, req => req == null ? map(message as ActorResponse, res => res == null ? CreateMessage(message, to, sender, type, tag) : CreateResponse(res, to, sender)) : CreateRequest(req, to, sender));
Unit TellNoIO(object message, ProcessId sender, string inbox, Message.Type type, Message.TagSpec tag) { ValidateMessageType(message, sender); var dto = RemoteMessageDTO.Create(message, ProcessId, sender, type, tag); var inboxKey = ActorInboxCommon.ClusterInboxKey(ProcessId, inbox); var inboxNotifyKey = ActorInboxCommon.ClusterInboxNotifyKey(ProcessId, inbox); Cluster.Enqueue(inboxKey, dto); var clientsReached = Cluster.PublishToChannel(inboxNotifyKey, dto.MessageId); return(unit); }
public Unit Tell(object message, ProcessId sender, string inbox, Message.Type type, Message.TagSpec tag) => ProcessOp.IO(() => TellNoIO(message, sender, inbox, type, tag));
public Unit Tell(object message, Schedule schedule, ProcessId sender, Message.TagSpec tag) { var sessionId = ActorContext.SessionId; return(LocalScheduler.Push(schedule, Actor.Id, m => Inbox.Tell(Inbox.ValidateMessageType(m, sender), sender, sessionId), message)); }
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => Tell(message, sender, "user", Message.Type.User, tag);
internal static RemoteMessageDTO Create(object message, ProcessId to, ProcessId sender, Message.Type type, Message.TagSpec tag, Option <SessionId> sessionId, long due) => map(message as ActorRequest, req => req == null ? map(message as ActorResponse, res => res == null ? CreateMessage(message, to, sender, type, tag, sessionId, due) : CreateResponse(res, to, sender, sessionId)) : CreateRequest(req, to, sender, sessionId));
public Unit Tell(object message, Schedule schedule, ProcessId sender, Message.TagSpec tag) => LocalScheduler.Push(schedule, ProcessId, m => Tell(m, sender, "tell", Message.Type.User), message);
Unit DoScheduleNoIO(object message, ProcessId sender, Schedule schedule, Message.Type type, Message.TagSpec tag) { var inboxKey = ActorInboxCommon.ClusterScheduleKey(ProcessId); var id = schedule.Key ?? Guid.NewGuid().ToString(); var current = Cluster.GetHashField <RemoteMessageDTO>(inboxKey, id); message = current.Match( Some: last => { var a = MessageSerialiser.DeserialiseMsg(last, ProcessId) as UserMessage; var m = a == null ? message : schedule.Fold(a.Content, message); return(m); }, None: () => schedule.Fold(schedule.Zero, message)); ValidateMessageType(message, sender); var dto = RemoteMessageDTO.Create(message, ProcessId, sender, type, tag, SessionId, schedule.Due.Ticks); tell(ProcessId.Take(1).Child("system").Child("scheduler"), Scheduler.Msg.AddToSchedule(inboxKey, id, dto)); //Cluster.HashFieldAddOrUpdate(inboxKey, id, dto); return(unit); }
Unit DoSchedule(object message, Schedule schedule, ProcessId sender, Message.Type type, Message.TagSpec tag) => transactionalIO ? DoScheduleNoIO(message, sender, schedule, type, tag) : ProcessOp.IO(() => DoScheduleNoIO(message, sender, schedule, type, tag));
public Unit Tell(object message, Schedule schedule, ProcessId sender, string inbox, Message.Type type, Message.TagSpec tag) => schedule == Schedule.Immediate ? transactionalIO ? TellNoIO(message, sender, inbox, type, tag) : ProcessOp.IO(() => TellNoIO(message, sender, inbox, type, tag)) : schedule.Type == Schedule.PersistenceType.Ephemeral ? LocalScheduler.Push(schedule, ProcessId, m => TellNoIO(m, sender, inbox, type, tag), message) : DoSchedule(message, schedule, sender, type, tag);
public Unit Tell(object message, Schedule schedule, ProcessId sender, Message.TagSpec tag) => LocalScheduler.Push(schedule, Actor.Id, m => Inbox.Tell(Inbox.ValidateMessageType(m, sender), sender), message);
public TellMessage(ProcessId processId, object message, ProcessId sender, TagSpec tag) { ProcessId = processId; Message = message; Sender = sender; this.tag = tag; }
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => Raise <Unit>(sender);
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => ProcessOp.IO(() => { message = Inbox.ValidateMessageType(message, sender); return(Inbox.Tell(message, sender)); });
internal static RemoteMessageDTO CreateMessage(object message, ProcessId to, ProcessId sender, Message.Type type, Message.TagSpec tag, Option <SessionId> sessionId, long due) => new RemoteMessageDTO { Type = (int)type, Tag = (int)tag, To = to.ToString(), RequestId = -1, MessageId = Guid.NewGuid(), Sender = sender.ToString(), ReplyTo = sender.ToString(), ContentType = message?.GetType()?.AssemblyQualifiedName, Content = message == null ? null : JsonConvert.SerializeObject(message, ActorSystemConfig.Default.JsonSerializerSettings), SessionId = sessionId.Map(s => s.Value).IfNoneUnsafe(() => null), Due = due };
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => transactionalIO ? Inbox.Tell(Inbox.ValidateMessageType(message, sender), sender) : ProcessOp.IO(() => Inbox.Tell(Inbox.ValidateMessageType(message, sender), sender));
public Unit Tell(object message, ProcessId sender, Message.TagSpec tag) => Inbox.Tell(message, sender);