Beispiel #1
0
 public static IConveyBuilder AddMessageOutbox(this IConveyBuilder builder)
 {
     builder.AddMongo();
     builder.AddMongoRepository <OutboxMessage, Guid>("outbox");
     builder.Services.AddTransient <IMessageOutbox, MongoMessageOutbox>();
     builder.Services.AddHostedService <OutboxProcessor>();
     return(builder);
 }
Beispiel #2
0
        public static IConveyBuilder AddMessageOutbox(this IConveyBuilder builder, string sectionName = SectionName)
        {
            if (!builder.TryRegister(RegistryName))
            {
                return(builder);
            }

            var options = builder.GetOptions <OutboxOptions>(sectionName);

            builder.Services.AddSingleton(options);
            builder.AddMongo();
            builder.AddMongoRepository <OutboxMessage, Guid>("outbox");
            builder.Services.AddTransient <IMessageOutbox, MongoMessageOutbox>();
            builder.Services.AddHostedService <OutboxProcessor>();
            return(builder);
        }
Beispiel #3
0
        public static IConveyBuilder AddMessageOutbox(this IConveyBuilder builder, string sectionName = SectionName)
        {
            if (!builder.TryRegister(RegistryName))
            {
                return(builder);
            }

            var options = builder.GetOptions <OutboxOptions>(sectionName);

            builder.Services.AddSingleton(options);

            switch (options.Type?.ToLowerInvariant() ?? string.Empty)
            {
            default:
                builder.AddMongo();
                builder.AddMongoRepository <OutboxMessage, Guid>("outbox");
                builder.Services.AddTransient <IMessageOutbox, MongoMessageOutbox>();
                builder.Services.AddHostedService <OutboxProcessor>();
                break;
            }

            return(builder);
        }