using Microsoft.Extensions.DependencyInjection; using Rebus.Persistence.InMem; using Rebus.Transport.InMem; using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Rebus; using Volo.Abp.Modularity; using Volo.Abp.MongoDB; using Volo.Abp.MongoDB.DistributedEvents; namespace DistDemoApp { [DependsOn( typeof(AbpMongoDbModule), typeof(AbpEventBusRebusModule), typeof(DistDemoAppSharedModule) )] public class DistDemoAppMongoDbRebusModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { PreConfigure(options => { options.InputQueueName = "eventbus"; options.Configurer = rebusConfigurer => { rebusConfigurer.Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "eventbus")); rebusConfigurer.Subscriptions(s => s.StoreInMemory()); }; }); } public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddMongoDbContext(options => { options.AddDefaultRepositories(); }); Configure(options => { options.Outboxes.Configure(config => { config.UseMongoDbContext(); }); options.Inboxes.Configure(config => { config.UseMongoDbContext(); }); }); } } }