/// <summary>
        /// 创建一个发送IConnection。
        /// </summary>
        /// <returns></returns>
        internal static IConnection CreateSendConnection(MqConfigDom mqConfigDom)
        {
            const ushort heartbeat = 60;
            var          factory   = new ConnectionFactory()
            {
                HostName                 = mqConfigDom.MqSendHost,
                UserName                 = mqConfigDom.MqUserName,
                Password                 = mqConfigDom.MqPassword,
                RequestedHeartbeat       = heartbeat, //心跳超时时间
                AutomaticRecoveryEnabled = true       //自动重连
            };

            return(factory.CreateConnection()); //创建连接对象
        }
        /// <summary>
        /// 根据实例名称获取对应配置
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        internal static RabbitMqClientContext GetContext(string typeName)
        {
            MqConfigDom dom = MqConfigDomFactory.CreateConfigDomInstance(typeName);

            return(new RabbitMqClientContext
            {
                ListenQueueName = dom.MqListenQueueName,
                SendQueueName = dom.MqSendQueueName,
                InstanceCode = Guid.NewGuid().ToString(),
                ListenConnection = CreateListenConnection(dom),
                SendConnection = CreateSendConnection(dom),
                mqConfigDom = dom
            });
        }