Exemplo n.º 1
0
 /// <summary>
 /// Delivers a user sent message to the correct domain. If the correct domain is not valid, an error is logged.
 /// </summary>
 /// <param name="message">The UserMessage object for the message.</param>
 public static void DeliverMessage(UserMessage message)
 {
     if (domains.ContainsKey(message.DomainKey)) {
         DomainProxy proxy = proxies[message.DomainKey];
         Node node = Nodes.GetNodeByID(message.Sender);
         proxy.DeliverMessage(message.Message, node);
     } else {
         Log.Error("No domain with Key: " + message.DomainKey + " was found to deliver message: \"" + message.Message + "\" from: NodeID: " + message.Sender);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Send a message to the node with the specified ID.
 /// </summary>
 /// <param name="message">The user message struct to be sent.</param>
 public void SendMessage(UserMessage message)
 {
     if (!HasDomain(message.DomainKey))
     {
         //get the assemblies
         Dictionary<string, byte[]> assemblies = DomainManager.GetDomainAssemblies(message.DomainKey);
         foreach (KeyValuePair<string, byte[]> assem in assemblies)
         {
             deliverAssembly(assem.Key, assem.Value, message.DomainKey);
         }
     }
     assemblyLoadReset.WaitOne();
     SerializationEngine serializer = new SerializationEngine ();
     client.Write(MessageType.USER_MESSAGE, serializer.Serialize(message));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Send a message to the node with the specified ID.
 /// </summary>
 /// <param name="nodeID">The node ID of the node to send the message to.</param>
 /// <param name="message">The message to be sent.</param>
 /// <param name="domainKey">The domain Key to deliver the message to.</param>
 public static void SendMessage(string nodeID, string message, string domainKey)
 {
     Node remoteNode = getNodeByID(nodeID);
     if (remoteNode != null) {
         UserMessage mesg = new UserMessage(message, ClusterManager.NodeID, domainKey);
         remoteNode.SendMessage(mesg);
     } else {
         //No node could be found matching the specefied id, log error and lost message
         Log.Error("No node with ID: " + nodeID + " could be found to dispatch message: \"" + message + "\" to.");
     }
 }