Browse Source

DistributedEventBusOptions to AbpDistributedEventBusOptions

pull/1919/head
Yunus Emre Kalkan 6 years ago
parent
commit
8b58991ff3
  1. 4
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs
  2. 8
      framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
  3. 2
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs
  4. 4
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs
  5. 6
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus.cs
  6. 2
      framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs
  7. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs
  8. 2
      modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs

4
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs

@ -11,10 +11,10 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency
{
protected IHybridServiceScopeFactory HybridServiceScopeFactory { get; }
protected DistributedEventBusOptions Options { get; }
protected AbpDistributedEventBusOptions Options { get; }
public EntityToEtoMapper(
IOptions<DistributedEventBusOptions> options,
IOptions<AbpDistributedEventBusOptions> options,
IHybridServiceScopeFactory hybridServiceScopeFactory)
{
HybridServiceScopeFactory = hybridServiceScopeFactory;

8
framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs

@ -23,7 +23,7 @@ namespace Volo.Abp.EventBus.RabbitMq
public class RabbitMqDistributedEventBus : EventBusBase, IDistributedEventBus, ISingletonDependency
{
protected AbpRabbitMqEventBusOptions AbpRabbitMqEventBusOptions { get; }
protected DistributedEventBusOptions DistributedEventBusOptions { get; }
protected AbpDistributedEventBusOptions AbpDistributedEventBusOptions { get; }
protected IConnectionPool ConnectionPool { get; }
protected IRabbitMqSerializer Serializer { get; }
@ -38,14 +38,14 @@ namespace Volo.Abp.EventBus.RabbitMq
IConnectionPool connectionPool,
IRabbitMqSerializer serializer,
IServiceScopeFactory serviceScopeFactory,
IOptions<DistributedEventBusOptions> distributedEventBusOptions,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions,
IRabbitMqMessageConsumerFactory messageConsumerFactory)
: base(serviceScopeFactory)
{
ConnectionPool = connectionPool;
Serializer = serializer;
MessageConsumerFactory = messageConsumerFactory;
DistributedEventBusOptions = distributedEventBusOptions.Value;
AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
AbpRabbitMqEventBusOptions = options.Value;
HandlerFactories = new ConcurrentDictionary<Type, List<IEventHandlerFactory>>();
@ -71,7 +71,7 @@ namespace Volo.Abp.EventBus.RabbitMq
Consumer.OnMessageReceived(ProcessEventAsync);
SubscribeHandlers(DistributedEventBusOptions.Handlers);
SubscribeHandlers(AbpDistributedEventBusOptions.Handlers);
}
private async Task ProcessEventAsync(IModel channel, BasicDeliverEventArgs ea)

2
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs

@ -37,7 +37,7 @@ namespace Volo.Abp.EventBus
options.Handlers.AddIfNotContains(localHandlers);
});
services.Configure<DistributedEventBusOptions>(options =>
services.Configure<AbpDistributedEventBusOptions>(options =>
{
options.Handlers.AddIfNotContains(distributedHandlers);
});

4
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusOptions.cs → framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs

@ -2,12 +2,12 @@ using Volo.Abp.Collections;
namespace Volo.Abp.EventBus.Distributed
{
public class DistributedEventBusOptions
public class AbpDistributedEventBusOptions
{
public ITypeList<IEventHandler> Handlers { get; }
public EtoMappingDictionary EtoMappings { get; set; }
public DistributedEventBusOptions()
public AbpDistributedEventBusOptions()
{
Handlers = new TypeList<IEventHandler>();
EtoMappings = new EtoMappingDictionary();

6
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus.cs

@ -17,16 +17,16 @@ namespace Volo.Abp.EventBus.Distributed
protected IServiceScopeFactory ServiceScopeFactory { get; }
protected DistributedEventBusOptions DistributedEventBusOptions { get; }
protected AbpDistributedEventBusOptions AbpDistributedEventBusOptions { get; }
public LocalDistributedEventBus(
ILocalEventBus localEventBus,
IServiceScopeFactory serviceScopeFactory,
IOptions<DistributedEventBusOptions> distributedEventBusOptions)
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions)
{
_localEventBus = localEventBus;
ServiceScopeFactory = serviceScopeFactory;
DistributedEventBusOptions = distributedEventBusOptions.Value;
AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
Subscribe(distributedEventBusOptions.Value.Handlers);
}

2
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs

@ -44,7 +44,7 @@ namespace Volo.Abp.TestApp
private void ConfigureDistributedEventBus()
{
Configure<DistributedEventBusOptions>(options =>
Configure<AbpDistributedEventBusOptions>(options =>
{
options.EtoMappings.Add<Person, PersonEto>();
});

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs

@ -18,7 +18,7 @@ namespace Volo.Abp.Identity
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<DistributedEventBusOptions>(options =>
Configure<AbpDistributedEventBusOptions>(options =>
{
options.EtoMappings.Add<IdentityUser, UserEto>();
});

2
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs

@ -30,7 +30,7 @@ namespace Volo.Abp.Identity
[Fact]
public async Task Should_Register_Handler()
{
var options = GetRequiredService<IOptions<DistributedEventBusOptions>>().Value;
var options = GetRequiredService<IOptions<AbpDistributedEventBusOptions>>().Value;
options.EtoMappings.ShouldContain(m => m.Key == typeof(IdentityUser) && m.Value.EtoType == typeof(UserEto));
options.Handlers.ShouldContain(h => h == typeof(DistributedUserUpdateHandler));
}

Loading…
Cancel
Save