示例#1
0
        public static IDrexBuilder AddRabbitMq <TContext>(this IDrexBuilder builder,
                                                          Func <IRabbitMqOptionsBuilder, IRabbitMqOptionsBuilder> buildOptions,
                                                          Func <IRabbitMqPluginRegister, IRabbitMqPluginRegister> plugins     = null,
                                                          Func <IRedisOptionsBuilder, IRedisOptionsBuilder> buildRedisOptions = null)
            where TContext : class, new()
        {
            var options = buildOptions(new RabbitMqOptionsBuilder()).Build();

            return(buildRedisOptions is null
                ? builder.AddRabbitMq <TContext>(options, plugins)
                : builder.AddRabbitMq <TContext>(options, plugins, b => b.AddRedis(buildRedisOptions)));
        }
示例#2
0
 public static IDrexBuilder AddRabbitMq <TContext>(this IDrexBuilder builder, RabbitMqOptions options,
                                                   Func <IRabbitMqPluginRegister, IRabbitMqPluginRegister> plugins = null,
                                                   RedisOptions redisOptions = null)
     where TContext : class, new()
 {
     return(builder.AddRabbitMq <TContext>(options, plugins, b => b.AddRedis(redisOptions ?? new RedisOptions())));
 }
示例#3
0
        public static IDrexBuilder AddRabbitMq <TContext>(this IDrexBuilder builder,
                                                          string sectionName      = SectionName,
                                                          string redisSectionName = "redis", Func <IRabbitMqPluginRegister, IRabbitMqPluginRegister> plugins = null)
            where TContext : class, new()
        {
            if (string.IsNullOrWhiteSpace(sectionName))
            {
                sectionName = SectionName;
            }

            var options      = builder.GetOptions <RabbitMqOptions>(sectionName);
            var redisOptions = builder.GetOptions <RedisOptions>(redisSectionName);

            return(builder.AddRabbitMq <TContext>(options, plugins, b => b.AddRedis(redisOptions)));
        }