Пример #1
0
 public BuildMessageBusiness()
 {
     _notifyMessageBus = new NotifyMessageBusiness();
     _pushMessageBus   = new PushMessageBusiness(BuilderServiceSetting.AutoFlushSendMessage);
     _notifySettingBus = new NotifyInterfaceSettingBusiness();
     if (BuilderServiceSetting.IsOpenBatchSaveNotifyMessage)
     {
         _saveNotifyPool = new DataBufferPool(new WaitCallback(BatchSaveNotifyMessage), BuilderServiceSetting.AutoFlushNotifyMessage, false);
     }
     if (BuilderServiceSetting.IsOpenBatchSavePushMessage)
     {
         _savePushPool = new DataBufferPool(new WaitCallback(BatchSavePushMessage), BuilderServiceSetting.AutoFlushPushMessage, false);
     }
     if (BuilderServiceSetting.IsOpenBatchReceiveHighMessage)
     {
         _highPool = new DataBufferPool(new WaitCallback(BuildBufferMessage), BuilderServiceSetting.AutoFlushReceiveHighMessage, false);
     }
     if (BuilderServiceSetting.IsOpenBatchReceiveMiddleMessage)
     {
         _middlePool = new DataBufferPool(new WaitCallback(BuildBufferMessage), BuilderServiceSetting.AutoFlushReceiveMiddleMessage, false);
     }
     if (BuilderServiceSetting.IsOpenBatchReceiveNormalMessage)
     {
         _normalPool = new DataBufferPool(new WaitCallback(BuildBufferMessage), BuilderServiceSetting.AutoFlushReceiveNormalMessage, false);
     }
     if (BuilderServiceSetting.IsOpenBatchReceiveLowMessage)
     {
         _lowPool = new DataBufferPool(new WaitCallback(BuildBufferMessage), BuilderServiceSetting.AutoFlushReceiveLowMessage, false);
     }
     _repeatSavePool = new DataBufferPool(new WaitCallback(RepeatSaveMessage), 5, false);
 }
Пример #2
0
        private bool Valid(NotifyMessage message, out string errMsg)
        {
            errMsg = "";
            NotifyMessageBusiness business = new NotifyMessageBusiness();

            if (string.IsNullOrEmpty(message.AppId))
            {
                errMsg = "消息的AppId不能为空";
                return(false);
            }
            if (string.IsNullOrEmpty(message.MessageKey))
            {
                errMsg = "消息的MessageKey不能为空";
                return(false);
            }
            if (string.IsNullOrEmpty(message.MessageType))
            {
                errMsg = "消息的MessageType不能为空";
                return(false);
            }
            if (string.IsNullOrEmpty(message.NotifyData))
            {
                errMsg = "消息的NotifyData不能为空";
                return(false);
            }
            if (string.IsNullOrEmpty(message.SourceFrom))
            {
                errMsg = "消息的SourceFrom不能为空";
                return(false);
            }
            List <NotifyMessageTypeModel> messageTypeList = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition());
            NotifyMessageTypeModel        messageTypeMod  = messageTypeList.Find(x => x.MessageType.ToString().Equals(message.MessageType, StringComparison.OrdinalIgnoreCase));

            if (messageTypeMod == null)
            {
                errMsg = "消息类型与系统定义不一致";
                Process.Info(message.MessageId, "消息类型初始化验证", "ReceiveMessageBusiness.Valid()", message.MessageKey, string.Format("消息类型与系统定义不一致,消息ID【{0}】,传值类型为【{1}】", message.MessageId, message.MessageType), "");
                return(false);
            }
            if (message.MessagePriority == MessagePriorityEnum.None)
            {
                message.MessagePriority = messageTypeMod.MessagePriority;
            }
            return(true);
        }
Пример #3
0
        /// <summary>
        /// 获取请求消息列表(分页)
        /// </summary>
        /// <param name="con"></param>
        /// <returns></returns>
        public List <NotifyMessageModel> GetNotifyMessageList(NotifyMessageCondition con)
        {
            NotifyMessageBusiness business        = new NotifyMessageBusiness();
            var messageTypeList                   = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition());
            List <NotifyMessageEntity> entityList = JinRiNotifyFacade.Instance.GetNotifyMessageList(con);
            List <NotifyMessageModel>  list       = new List <NotifyMessageModel>();

            entityList.ForEach(x =>
            {
                var model       = MappingHelper.From <NotifyMessageModel, NotifyMessageEntity>(x);
                var messageType = messageTypeList.Where(t => t.MessageType.ToString().Equals(model.MessageType, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                if (messageType != null)
                {
                    model.MessageTypeCName = messageType.Remark;
                }
                list.Add(model);
            });
            return(list);
        }
Пример #4
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        /// <param name="con">查询条件</param>
        /// <returns></returns>
        public List <NotifyInterfaceSettingModel> GetList(NotifyInterfaceSettingCondition condition)
        {
            NotifyMessageBusiness business = new NotifyMessageBusiness();
            var messageTypeList            = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition());
            List <NotifyInterfaceSettingEntity> entityList  = JinRiNotifyFacade.Instance.GetNotifyInterfaceSettingList(condition);
            List <NotifyInterfaceSettingModel>  messageList = new List <NotifyInterfaceSettingModel>();

            entityList.ForEach((x) =>
            {
                var model       = MappingHelper.From <NotifyInterfaceSettingModel, NotifyInterfaceSettingEntity>(x);
                var messageType = messageTypeList.Where(t => t.MessageType == model.MessageType).FirstOrDefault();
                if (messageType != null)
                {
                    model.MessageTypeName = messageType.Remark;
                }
                model.MessageTypeEName = x.MessageType.ToString();
                messageList.Add(model);
            });
            return(messageList);
        }
Пример #5
0
        /// <summary>
        /// 获取推送消息列表(分页)
        /// </summary>
        /// <param name="con"></param>
        /// <returns></returns>
        public List <PushMessageModel> GetPageList(PushMessageCondition con)
        {
            NotifyMessageBusiness business      = new NotifyMessageBusiness();
            var messageTypeList                 = business.GetNotifyMessageTypeList(new NotifyMessageTypeCondition());
            List <PushMessageEntity> entityList = JinRiNotifyFacade.Instance.GetPushMessagePageList(con);
            List <PushMessageModel>  list       = new List <PushMessageModel>();

            entityList.ForEach(x =>
            {
                var model       = MappingHelper.From <PushMessageModel, PushMessageEntity>(x);
                var messageType = messageTypeList.Where(t => t.MessageType == model.MessageType).FirstOrDefault();
                if (messageType != null)
                {
                    model.MessageTypeCName = messageType.Remark;
                }
                model.MessagePriorityName = x.MessagePriority.ToString();
                model.PushStatusName      = Enum.GetName(typeof(PushStatusEnum), x.PushStatus);
                model.MessageTypeEName    = x.MessageType.ToString();
                list.Add(model);
            });
            return(list);
        }