Browse Source

RabbitMqEventBusOptions to AbpRabbitMqEventBusOptions

pull/1919/head
Yunus Emre Kalkan 7 years ago
parent
commit
c5640700dd
  1. 2
      framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpEventBusRabbitMqModule.cs
  2. 2
      framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs
  3. 18
      framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
  4. 2
      samples/RabbitMqEventBus/App1/App1Module.cs
  5. 2
      samples/RabbitMqEventBus/App2/App2Module.cs

2
framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpEventBusRabbitMqModule.cs

@ -13,7 +13,7 @@ namespace Volo.Abp.EventBus.RabbitMq
{
var configuration = context.Services.GetConfiguration();
Configure<RabbitMqEventBusOptions>(configuration.GetSection("RabbitMQ:EventBus"));
Configure<AbpRabbitMqEventBusOptions>(configuration.GetSection("RabbitMQ:EventBus"));
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

2
framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqEventBusOptions.cs → framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.EventBus.RabbitMq
{
public class RabbitMqEventBusOptions
public class AbpRabbitMqEventBusOptions
{
public string ConnectionName { get; set; }

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

@ -22,7 +22,7 @@ namespace Volo.Abp.EventBus.RabbitMq
[ExposeServices(typeof(IDistributedEventBus), typeof(RabbitMqDistributedEventBus))]
public class RabbitMqDistributedEventBus : EventBusBase, IDistributedEventBus, ISingletonDependency
{
protected RabbitMqEventBusOptions RabbitMqEventBusOptions { get; }
protected AbpRabbitMqEventBusOptions AbpRabbitMqEventBusOptions { get; }
protected DistributedEventBusOptions DistributedEventBusOptions { get; }
protected IConnectionPool ConnectionPool { get; }
protected IRabbitMqSerializer Serializer { get; }
@ -34,7 +34,7 @@ namespace Volo.Abp.EventBus.RabbitMq
protected IRabbitMqMessageConsumer Consumer { get; private set; }
public RabbitMqDistributedEventBus(
IOptions<RabbitMqEventBusOptions> options,
IOptions<AbpRabbitMqEventBusOptions> options,
IConnectionPool connectionPool,
IRabbitMqSerializer serializer,
IServiceScopeFactory serviceScopeFactory,
@ -46,7 +46,7 @@ namespace Volo.Abp.EventBus.RabbitMq
Serializer = serializer;
MessageConsumerFactory = messageConsumerFactory;
DistributedEventBusOptions = distributedEventBusOptions.Value;
RabbitMqEventBusOptions = options.Value;
AbpRabbitMqEventBusOptions = options.Value;
HandlerFactories = new ConcurrentDictionary<Type, List<IEventHandlerFactory>>();
EventTypes = new ConcurrentDictionary<string, Type>();
@ -56,17 +56,17 @@ namespace Volo.Abp.EventBus.RabbitMq
{
Consumer = MessageConsumerFactory.Create(
new ExchangeDeclareConfiguration(
RabbitMqEventBusOptions.ExchangeName,
AbpRabbitMqEventBusOptions.ExchangeName,
type: "direct",
durable: true
),
new QueueDeclareConfiguration(
RabbitMqEventBusOptions.ClientName,
AbpRabbitMqEventBusOptions.ClientName,
durable: true,
exclusive: false,
autoDelete: false
),
RabbitMqEventBusOptions.ConnectionName
AbpRabbitMqEventBusOptions.ConnectionName
);
Consumer.OnMessageReceived(ProcessEventAsync);
@ -171,10 +171,10 @@ namespace Volo.Abp.EventBus.RabbitMq
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
var body = Serializer.Serialize(eventData);
using (var channel = ConnectionPool.Get(RabbitMqEventBusOptions.ConnectionName).CreateModel())
using (var channel = ConnectionPool.Get(AbpRabbitMqEventBusOptions.ConnectionName).CreateModel())
{
channel.ExchangeDeclare(
RabbitMqEventBusOptions.ExchangeName,
AbpRabbitMqEventBusOptions.ExchangeName,
"direct",
durable: true
);
@ -183,7 +183,7 @@ namespace Volo.Abp.EventBus.RabbitMq
properties.DeliveryMode = RabbitMqConsts.DeliveryModes.Persistent;
channel.BasicPublish(
exchange: RabbitMqEventBusOptions.ExchangeName,
exchange: AbpRabbitMqEventBusOptions.ExchangeName,
routingKey: eventName,
mandatory: true,
basicProperties: properties,

2
samples/RabbitMqEventBus/App1/App1Module.cs

@ -12,7 +12,7 @@ namespace App1
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<RabbitMqEventBusOptions>(options =>
Configure<AbpRabbitMqEventBusOptions>(options =>
{
options.ClientName = "TestApp1";
options.ExchangeName = "TestMessages";

2
samples/RabbitMqEventBus/App2/App2Module.cs

@ -12,7 +12,7 @@ namespace App2
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<RabbitMqEventBusOptions>(options =>
Configure<AbpRabbitMqEventBusOptions>(options =>
{
options.ClientName = "TestApp2";
options.ExchangeName = "TestMessages";

Loading…
Cancel
Save