Ejemplo n.º 1
0
        /// <summary>
        /// 启用RabbitMq
        /// </summary>
        /// <param name="configuration">配置</param>
        public static void UseRabbitMq(IServiceCollection services, IConfiguration configuration)
        {
            services.Configure <RabbitMqMessageBusOptions>(options =>
            {
                RabbitMqMessageBusBootstrap.SetRabbitMqOptions(configuration, options);
            });

            services.AddSingleton <IMessageBus, DefaultRabbitMqMessageBus>();
            Console.WriteLine("RabbitMq 注入完成。");
        }
 /// <summary>
 /// 注入RabbitMq Bus默认实例
 /// </summary>
 /// <param name="services">服务容器</param>
 /// <param name="configuration">配置</param>
 /// <returns></returns>
 public static void AddRabbitMq(this IServiceCollection services, IConfiguration configuration)
 {
     RabbitMqMessageBusBootstrap.UseRabbitMq(services, configuration);
 }