Example #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="pluginPath"></param>
 /// <param name="channel"></param>
 /// <param name="config"></param>
 public BaseConsumer(IModel channel, RabbitmqServiceOptions config)
 {
     _config             = config;
     _channel            = channel;
     _retryQueueName     = _config.QueueName.GetTaskRoutingKey();;                                 //重试队列名称
     config.ExchangeName = config.PatternType.GetExchangeName(config.ExchangeName);                //交换机名称
     _retryTimeRules     = config?.RetryTimeRules?.Select(p => p * 1000).OrderBy(p => p).ToList(); //加载重试的时间规则
 }
Example #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="config"></param>
 public RoutingConsumer(IModel channel, RabbitmqServiceOptions config)
     : base(channel, config)
 {
 }
Example #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="config"></param>
 public SubscribeConsumer(IModel channel, RabbitmqServiceOptions config)
     : base(channel, config)
 {
 }
Example #4
0
 /// <summary>
 /// 创建对象实例
 /// </summary>
 /// <param name="pluginPath"></param>
 /// <param name="config"></param>
 /// <returns></returns>
 public static T GetInstance <T>(string pluginPath, RabbitmqServiceOptions config) where T : class
 {
     return(GetInstance <T>(pluginPath, config.AssemblyName, config.NameSpace, config.ClassName));
 }