void Cluster_MessageRecieved(string payload, ClusterNode sender) { //if this is the response message, write the response to the console. if (payload == "response") { Console.WriteLine("Response from: " + sender.HostName); } else { Cluster.SendMessage(sender, "response"); } }
/// <summary> /// Deliver the message from a remote node. /// </summary> /// <param name="payload">The message sent.</param> /// <param name="sender"> The Node ID of the sending node.</param> internal static void DeliverMessage(string payload, ClusterNode sender) { MessageRecieved(payload, sender); }
/// <summary> /// Send a message to the node with the specified ID. The message is delivered to /// the receiving node and calls the MessageReceived event. /// </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> public static void SendMessage(ClusterNode node, string message) { ClusterProxy.SendMessage(node.NodeID, message, Key); }