Пример #1
0
        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]);
                }
            }
        }
Пример #2
0
        static void StartWorker(string endpoint)
        {
            SynapseEndpoint WorkReceiver = new SynapseEndpoint(endpoint);

            WorkReceiver.Connect();
            WorkReceiver.ReceiveMessages(ToUpperReplyToSender, true, WorkReceiver);
        }
Пример #3
0
        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);
            }
        }