static void StartWorker(string endpoint) { SynapseEndpoint WorkReceiver = new SynapseEndpoint(endpoint); WorkReceiver.Connect(); WorkReceiver.ReceiveMessages(ToUpperReplyToSender, true, WorkReceiver); }
static void StartHandler(String sendOn, String listenOn) { SynapseEndpoint Sender = new SynapseEndpoint(sendOn); Sender.Connect(); SynapseEndpoint Receiver = new SynapseEndpoint(listenOn); Receiver.Connect(); new Thread(() => Receiver.ReceiveMessages(ProcessHandlerRequest, false, Sender)).Start(); while (true) { String input = Console.ReadLine(); String[] strs = input.Split(','); if (strs[0] == "STATUS") { Sender.SendMessage(null, MessageType.STATUS, strs[1]); } else if (strs[0] == "QUERY") { Sender.SendMessage(null, MessageType.REQUEST, strs[1]); } } }
static void StartClient(string endpoint) { SynapseEndpoint WorkRequest = new SynapseEndpoint(endpoint); WorkRequest.Connect(); new Thread(() => WorkRequest.ReceiveReplies(ProcessMyReplies)).Start(); while (true) { String message = Console.ReadLine(); WorkRequest.SendMessage(null, MessageType.REQUEST, message); } }
static void StartApi(string sendOn, string listenOn) { SynapseEndpoint Sender = new SynapseEndpoint(sendOn); Sender.Connect(); SynapseEndpoint Receiver = new SynapseEndpoint(listenOn); Receiver.Connect(); new Thread(() => Receiver.ReceiveMessages(ProcessApiRequest, false, Sender)).Start(); while (true) { String message = Console.ReadLine(); Sender.SendMessage(null, MessageType.REQUEST, message); } }