Ejemplo n.º 1
0
        private void DispatchMsg(MessageData msgdata)
        {
            ICommunicationHandler handler;
            switch (msgdata.TragetPlatform)
            {
                case PlatformType.Encrypt:
                    handler = new EncryptCommunicationHandler();
                    break;
                case PlatformType.Payment:
                case PlatformType.PaymentDownload:
                    handler = new PayCommunicationHandler();
                    break;
                case PlatformType.Core:
                    handler = new CoreCommunicationHandler();
                    break;
                case PlatformType.FingerMarks:
                    handler = new MarkComminicationHandler();
                    break;
                default:
                    handler = new NullableHandler();
                    break;
                    
            }

            AidLogHelper.Write(xQuant.Log4.LogLevel.Debug, "开始分发(MQHandlerSync),GUID=" + msgdata.MessageID);
            if (_dispatchMsg != null)
            {
                lock (_dispatchMsg)
                {
                    _dispatchMsg.MsgHandler = handler;
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            else
            {
                _dispatchMsg = new MsgDispatchEAP(handler);
                lock (_dispatchMsg)
                {
                    _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            AidLogHelper.Write(xQuant.Log4.LogLevel.Debug, "分发结束(MQHandlerSync),GUID="+ msgdata.MessageID);
        }
Ejemplo n.º 2
0
        private void DispatchMsg(MessageData msgdata)
        {
            ICommunicationHandler handler;
            switch (msgdata.TragetPlatform)
            {
                case PlatformType.Encrypt:
                    handler = new EncryptCommunicationHandler();
                    break;
                case PlatformType.Payment:
                case PlatformType.PaymentDownload:
                    handler = new PayCommunicationHandler();
                    break;
                case PlatformType.Core:
                    handler = new CoreCommunicationHandler();
                    break;
                case PlatformType.FingerMarks:
                    handler = new MarkComminicationHandler();
                    break;
                default:
                    handler = new NullableHandler();
                    break;
                    
            }

            if (_dispatchMsg != null)
            {
                lock (_dispatchMsg)
                {
                    _dispatchMsg.MsgHandler = handler;
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            else
            {
                _dispatchMsg = new MsgDispatchEAP(handler);
                lock (_dispatchMsg)
                {
                    _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
        }