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 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, ActorConfig.Default.JsonSerializerSettings) };
private static R EnsureInStore <R>(ProcessId id, Func <IImmutableDictionary <string, Subject <object> >, string, R> f) { var store = Store; var path = id.ToString(); return(store.ContainsKey(path) ? f(store, path) : f(AddToStore(id), path)); }
internal static RemoteMessageDTO CreateRequest(ActorRequest req, ProcessId to, ProcessId sender) => new RemoteMessageDTO { Type = (int)Message.Type.User, Tag = (int)Message.TagSpec.UserAsk, Child = null, Exception = null, To = to.Path, RequestId = req.RequestId, MessageId = Guid.NewGuid(), Sender = sender.ToString(), ReplyTo = req.ReplyTo.ToString(), ContentType = req.Message.GetType().AssemblyQualifiedName, Content = JsonConvert.SerializeObject(req.Message, ActorSystemConfig.Default.JsonSerializerSettings) };
internal static RemoteMessageDTO CreateResponse(ActorResponse res, ProcessId to, ProcessId sender) => new RemoteMessageDTO { Type = (int)Message.Type.User, Tag = (int)Message.TagSpec.UserReply, Child = null, Exception = res.IsFaulted ? "RESPERR" : null, To = to.ToString(), RequestId = res.RequestId, MessageId = Guid.NewGuid(), Sender = res.ReplyFrom.ToString(), ReplyTo = res.ReplyTo.ToString(), ContentType = res.Message.GetType().AssemblyQualifiedName, Content = JsonConvert.SerializeObject(res.Message, ActorSystemConfig.Default.JsonSerializerSettings) };
private static string ProcessFmt(ProcessId pid) => pid.IsValid ? pid.ToString() : "no-sender";
internal static RemoteMessageDTO CreateMessage(object message, ProcessId to, ProcessId sender, Message.Type type, Message.TagSpec tag, Option<SessionId> sessionId) => new RemoteMessageDTO { Type = (int)type, Tag = (int)tag, To = to.ToString(), 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), SessionId = sessionId.Map(s => s.Value).IfNoneUnsafe(() => null) };
internal static RemoteMessageDTO CreateResponse(ActorResponse res, ProcessId to, ProcessId sender, Option<SessionId> sessionId) => new RemoteMessageDTO { Type = (int)Message.Type.User, Tag = (int)Message.TagSpec.UserReply, Child = null, Exception = res.IsFaulted ? "RESPERR" : null, To = to.ToString(), RequestId = res.RequestId, MessageId = Guid.NewGuid(), Sender = res.ReplyFrom.ToString(), ReplyTo = res.ReplyTo.ToString(), ContentType = res.Message.GetType().AssemblyQualifiedName, Content = JsonConvert.SerializeObject(res.Message, ActorSystemConfig.Default.JsonSerializerSettings), SessionId = sessionId.Map(s => s.Value).IfNoneUnsafe(() => null) };