Exemple #1
0
        // Dealer-Receive接收信息
        private void ThreadDealerReceive()
        {
            using (DealerSocket dealerSocket = new DealerSocket())
            {
                dealerSocket.Options.Identity = Encoding.UTF8.GetBytes(PublicData.SessionId);
                dealerSocket.Connect(MQConfig.RouterSendServer);

                while (!PublicData.CancellationToken.IsCancellationRequested)
                {
                    try
                    {
                        KeyData kd = dealerSocket.DealerReceive();
                        Task.Factory.StartNew(() => HandleKeyData_DealerReceive(kd.Key, kd.DataString));
                    }
                    catch (Exception ex)
                    {
                        LogUtil.Error($"Dealer-Receive消息执行异常:{ex.Message}");
                    }
                }
            }
        }