Пример #1
0
        public static Either <string, Req> Create(ClientConnectionId id, ClientMessageId msgId, ProcessId to, ProcessId sender, string msg, Map <ClientConnectionId, ClientConnection> clientConnections)
        {
            if (!to.IsValid)
            {
                return("Invalid process-id (To)");
            }
            var conn = clientConnections.Find(id);

            if (conn.IsNone)
            {
                return("Invalid connection-id");
            }

            var msgObj = (from type in validMessageTypes(to)
                          let obj = Deserialise.Object(msg, type)
                                    where obj != null
                                    select obj)
                         .FirstOrDefault();

            if (msgObj == null)
            {
                return("Message incompatible with the inbox message type");
            }

            return(new AskReq(id, msgId, to, sender, msgObj, conn.IfNone(() => null)));
        }
Пример #2
0
 AskReq(ClientConnectionId id, ClientMessageId msgId, ProcessId to, ProcessId sender, object msg, ClientConnection connection)
 {
     Id         = id;
     MessageId  = msgId;
     To         = to;
     Sender     = sender;
     Message    = msg;
     Connection = connection;
 }