Пример #1
0
        /// <summary>
        /// 请求响应调用-队列化
        /// </summary>
        /// <param name="serviceName">服务名称</param>
        /// <param name="methodName">方法名称</param>
        /// <param name="message">消息内容</param>
        /// <param name="version">服务版本:0代表调用默认版本</param>
        /// <returns></returns>
        public void InvokeQueue(String serviceName, String methodName, String message, Int32 version = 0, AdvanceInvokeParam invokeParam = null)
        {
            //--从ESBConfig中获取到服务版本信息
            ServiceItem si = GetServiceItem(serviceName, version);

            //--从ESBConfig中获取到服务配置信息            
            EsbView_ServiceConfig sc = this.ESBConfig.GetServiceConfig(serviceName, GetMethodName(methodName));

            if (String.IsNullOrWhiteSpace(sc.QueueCenterUri)) 
                throw new Exception("服务需要在管理中心配置队列服务地址才能通过队列调用!");
            
            QueueMessage qm = new QueueMessage();
            qm.ConsumerAppName = m_ConsumerConfig.ApplicationName;

            if (invokeParam != null && !String.IsNullOrEmpty(invokeParam.ConsumerIP))
            {
                qm.ConsumerIP = invokeParam.ConsumerIP;
            }
            else
            {
                qm.ConsumerIP = m_ConfigurationManager.LocalIP;
            }

            qm.ServiceName = serviceName;
            qm.MethodName = methodName;
            qm.Message = message;
            qm.Version = version;


            m_MessageQueueClient.SendToInvokeQueue(qm);
        }
Пример #2
0
 /// <summary>
 /// 发送消息到ESB专用队列
 /// </summary>
 public void SendToInvokeQueue(QueueMessage qm)
 {
     SendMessage <QueueMessage>(Constant.ESB_INVOKE_QUEUE, qm);
 }