示例#1
0
        public BusinessService GetBusinessServiceByTemplateID(String templateID)
        {
            BindingTemplate binding = BindingTemplate.FindByTemplateID(templateID);

            if (binding == null)
            {
                return(null);
            }
            else
            {
                return(BusinessService.FindByServiceID(binding.ServiceID));
            }
        }
示例#2
0
        /// <summary>
        /// 处理日志消息
        /// </summary>
        public void ProcessAuditMessage()
        {
            try
            {
                m_RabbitMQ.Listen <AuditBusiness>(Constant.ESB_AUDIT_QUEUE, x =>
                {
                    if (x != null)
                    {
                        x.InBytes       = GetStringByteLength(x.MessageBody);
                        x.OutBytes      = GetStringByteLength(x.ReturnMessageBody);
                        x.RowMethodName = GetMethodName(x.MethodName);

                        String bindingID = x.BindingTemplateID;
                        if (!String.IsNullOrWhiteSpace(bindingID))
                        {
                            BindingTemplate binding = BindingTemplate.FindByTemplateID(bindingID);
                            if (binding != null)
                            {
                                x.ServiceID = binding.ServiceID;
                                if (binding.Service != null)
                                {
                                    x.BusinessID = binding.Service.BusinessID;
                                }
                            }
                        }

                        m_MonitorStatManager.Record(x);

                        //--采用线程池将数据提交到数据库中,增加统计发布的速度。
                        ThreadPool.QueueUserWorkItem(y =>
                        {
                            x.Insert();
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                XTrace.WriteLine("处理审计日志发生异常,消息将停止接收!异常详情:{0}", ex.ToString());
            }
        }
示例#3
0
        /// <summary>
        /// 处理异常消息
        /// </summary>
        public void ProcessExceptionMessage()
        {
            try
            {
                m_RabbitMQ.Listen <ExceptionCoreTb>(Constant.ESB_EXCEPTION_QUEUE, x =>
                {
                    if (x != null)
                    {
                        String bindingID = x.BindingTemplateID;
                        if (!String.IsNullOrWhiteSpace(bindingID))
                        {
                            BindingTemplate binding = BindingTemplate.FindByTemplateID(bindingID);
                            if (binding != null)
                            {
                                x.ServiceID = binding.ServiceID;
                                if (binding.Service != null)
                                {
                                    x.BusinessID = binding.Service.BusinessID;
                                }
                            }
                        }

                        if (x.ExceptionInfo.Contains("操作超时"))
                        {
                            x.ExceptionCode = "操作超时";
                        }

                        x.Insert();
                    }
                });
            }
            catch (Exception ex)
            {
                XTrace.WriteLine("处理异常日志发生异常,消息将停止接收!异常详情:{0}", ex.ToString());
            }
        }