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); }
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); }
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); }