/// <summary>
        /// 自定义配置
        /// </summary>
        /// <param name="config"></param>
        public RabbitMQSubscriber(RabbitMqConfig config)
        {
            //自定义MQ配置
            this.rabbitMqService = new RabbitMqService(config);

            //使用默认消息处理方式
            this.mqMsgHandler = new DefaultMQMsgHandler();
        }
        /// <summary>
        /// 自定义配置和消息处理方式
        /// </summary>
        /// <param name="config"></param>
        /// <param name="handler"></param>
        public RabbitMQSubscriber(RabbitMqConfig config, IMQMsgHandler handler)
        {
            //自定义MQ配置
            this.rabbitMqService = new RabbitMqService(config);

            //自定义消息处理方式
            this.mqMsgHandler = handler;
        }
        /// <summary>
        /// 默认配置
        /// </summary>
        public RabbitMQSubscriber()
        {
            //默认MQ配置
            this.rabbitMqService = new RabbitMqService(new RabbitMqConfig
            {
                AutomaticRecoveryEnabled = true,
                HeartBeat = 60,
                NetworkRecoveryInterval = new TimeSpan(60),
                Host     = "localhost",
                UserName = "******",
                Password = "******"
            });

            //使用默认消息处理方式
            this.mqMsgHandler = new DefaultMQMsgHandler();
        }
Пример #4
0
 public MQEventListener(IMQMsgHandler msgHandler)
 {
     _msgHandler = msgHandler;
 }