Browse Source

Implementing MultiEventBusRabbitMQ to allow for multiple connections to multiple virtual hosts in RabbitMQ, where it is intended to have one virtual host per tenant to achieve tenant isolation.

TODO: Implement in all microservices, and fix selection of actualEventBus in the Publish method in MultiEventBusRabbitMQ
pull/1240/head
espent1004 5 years ago
parent
commit
2a42053817
17 changed files with 115 additions and 73 deletions
  1. +6
    -4
      src/BuildingBlocks/EventBus/EventBus/Abstractions/IEventBus.cs
  2. +21
    -0
      src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs
  3. +18
    -11
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
  4. +11
    -7
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/MultiEventBusRabbitMQ.cs
  5. +2
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
  6. +2
    -2
      src/Services/Basket/Basket.API/Controllers/BasketController.cs
  7. +16
    -11
      src/Services/Basket/Basket.API/Startup.cs
  8. +4
    -4
      src/Services/Catalog/Catalog.API/Startup.cs
  9. +4
    -4
      src/Services/Location/Locations.API/Startup.cs
  10. +4
    -4
      src/Services/Marketing/Marketing.API/Startup.cs
  11. +4
    -4
      src/Services/Ordering/Ordering.API/Startup.cs
  12. +2
    -2
      src/Services/Ordering/Ordering.API/appsettings.json
  13. +5
    -3
      src/Services/Ordering/Ordering.BackgroundTasks/Startup.cs
  14. +4
    -4
      src/Services/Ordering/Ordering.SignalrHub/Startup.cs
  15. +4
    -4
      src/Services/Payment/Payment.API/Startup.cs
  16. +4
    -4
      src/Services/TenantCustomisations/TenantACustomisations/Startup.cs
  17. +4
    -4
      src/Services/Webhooks/Webhooks.API/Startup.cs

+ 6
- 4
src/BuildingBlocks/EventBus/EventBus/Abstractions/IEventBus.cs View File

@ -7,18 +7,20 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
{
void Publish(IntegrationEvent @event);
void Subscribe<T, TH>(String vHost)
void Subscribe<T, TH>()
where T : IntegrationEvent
where TH : IIntegrationEventHandler<T>;
void SubscribeDynamic<TH>(string eventName, String vHost)
void SubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler;
void UnsubscribeDynamic<TH>(string eventName, String vHost)
void UnsubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler;
void Unsubscribe<T, TH>(String vHost)
void Unsubscribe<T, TH>()
where TH : IIntegrationEventHandler<T>
where T : IntegrationEvent;
String GetVHost();
}
}

+ 21
- 0
src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs View File

@ -177,4 +177,25 @@ class CompositeHandler
{
public String TenantVHostName { get; set; }
public String EventName { get; set; }
protected bool Equals(CompositeHandler other)
{
return TenantVHostName == other.TenantVHostName && EventName == other.EventName;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((CompositeHandler) obj);
}
public override int GetHashCode()
{
unchecked
{
return ((TenantVHostName != null ? TenantVHostName.GetHashCode() : 0) * 397) ^ (EventName != null ? EventName.GetHashCode() : 0);
}
}
}

+ 18
- 11
src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs View File

@ -33,14 +33,15 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
private static readonly String tenantACustomisationUrl = @"http://tenantacustomisation/";
private static readonly String tenantManagerUrl = @"http://tenantmanager/";
private readonly int _retryCount;
private readonly Dictionary<int, String> _tenantInfo;
private readonly Dictionary<int, String> _tenantInfo;
public String vHost { get; set; }
private IModel _consumerChannel;
private string _queueName;
public EventBusRabbitMQ(IRabbitMQPersistentConnection persistentConnection, ILogger<EventBusRabbitMQ> logger,
ILifetimeScope autofac, IEventBusSubscriptionsManager subsManager, string queueName = null,
ILifetimeScope autofac, IEventBusSubscriptionsManager subsManager, String vhost, string queueName = null,
int retryCount = 5)
{
_persistentConnection =
@ -55,6 +56,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
_tenantInfo = new Dictionary<int, string>();
_tenantInfo.Add(1, "TenantA");
_tenantInfo.Add(2, "TenantB");
vHost = vhost;
}
private void SubsManager_OnEventRemoved(object sender, string eventName)
@ -126,23 +128,23 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
}
}
public void SubscribeDynamic<TH>(string eventName, String vHost)
public void SubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler
{
_logger.LogInformation("Subscribing to dynamic event {EventName} with {EventHandler}", eventName,
typeof(TH).GetGenericTypeName());
DoInternalSubscription(eventName, vHost);
DoInternalSubscription(eventName);
_subsManager.AddDynamicSubscription<TH>(eventName, vHost);
StartBasicConsume();
}
public void Subscribe<T, TH>(String vHost)
public void Subscribe<T, TH>()
where T : IntegrationEvent
where TH : IIntegrationEventHandler<T>
{
var eventName = _subsManager.GetEventKey<T>();
DoInternalSubscription(eventName, vHost);
DoInternalSubscription(eventName);
_logger.LogInformation("Subscribing to event {EventName} with {EventHandler}", eventName,
typeof(TH).GetGenericTypeName());
@ -151,7 +153,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
StartBasicConsume();
}
private void DoInternalSubscription(string eventName, String vHost)
private void DoInternalSubscription(string eventName)
{
var containsKey = _subsManager.HasSubscriptionsForEvent(eventName, vHost);
if (!containsKey)
@ -170,7 +172,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
}
}
public void Unsubscribe<T, TH>(String vHost)
public void Unsubscribe<T, TH>()
where T : IntegrationEvent
where TH : IIntegrationEventHandler<T>
{
@ -181,7 +183,12 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
_subsManager.RemoveSubscription<T, TH>(vHost);
}
public void UnsubscribeDynamic<TH>(string eventName, String vHost)
public string GetVHost()
{
return vHost;
}
public void UnsubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler
{
_subsManager.RemoveDynamicSubscription<TH>(eventName, vHost);
@ -337,11 +344,11 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
{
_logger.LogWarning("Processing RabbitMQ event: {EventName}", eventName);
if (_subsManager.HasSubscriptionsForEvent(eventName))
if (_subsManager.HasSubscriptionsForEvent(eventName, vHost))
{
using (var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME))
{
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
var subscriptions = _subsManager.GetHandlersForEvent(eventName, vHost);
foreach (var subscription in subscriptions)
{
if (subscription.IsDynamic)


+ 11
- 7
src/BuildingBlocks/EventBus/EventBusRabbitMQ/MultiEventBusRabbitMQ.cs View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
@ -6,7 +7,6 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
{
public class MultiEventBusRabbitMQ : IMultiEventBus
{
private List<IEventBus> _eventBuses;
public MultiEventBusRabbitMQ(List<IEventBus> eventBuses)
@ -21,16 +21,20 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
public void Publish(IntegrationEvent @event)
{
//TODO
var actualEventBus = _eventBuses.Find(e => e.GetVHost().Equals("TenantA"));
if (actualEventBus == null)
{
throw new Exception();
}
throw new System.NotImplementedException();
actualEventBus.Publish(@event);
}
public void Subscribe<T, TH>() where T : IntegrationEvent where TH : IIntegrationEventHandler<T>
{
_eventBuses.ForEach(e =>
{
e.Subscribe<T, TH>();
});
_eventBuses.ForEach(e => { e.Subscribe<T, TH>(); });
}
}
}

+ 2
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs View File

@ -1,4 +1,4 @@
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
/*namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{
using Autofac;
using Microsoft.Azure.ServiceBus;
@ -206,3 +206,4 @@
}
}
}
*/

+ 2
- 2
src/Services/Basket/Basket.API/Controllers/BasketController.cs View File

@ -21,14 +21,14 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
{
private readonly IBasketRepository _repository;
private readonly IIdentityService _identityService;
private readonly IEventBus _eventBus;
private readonly IMultiEventBus _eventBus;
private readonly ILogger<BasketController> _logger;
public BasketController(
ILogger<BasketController> logger,
IBasketRepository repository,
IIdentityService identityService,
IEventBus eventBus)
IMultiEventBus eventBus)
{
_logger = logger;
_repository = repository;


+ 16
- 11
src/Services/Basket/Basket.API/Startup.cs View File

@ -86,7 +86,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
});
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
{
@ -97,8 +98,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
});
}
else
}*/
/* else
{
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{
@ -120,7 +121,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
factory.Password = Configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -133,7 +134,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
});
});*/
services.AddSingleton<IMultiRabbitMQPersistentConnections>(sp =>
{
@ -146,7 +147,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
});
}
//}
RegisterEventBus(services);
@ -324,7 +325,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/*if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -338,7 +339,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
});
}
else
{
{*/
services.AddSingleton<IMultiEventBus, MultiEventBusRabbitMQ>(sp =>
{
@ -354,10 +355,14 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
}
List<IEventBus> eventBuses = new List<IEventBus>();
multiRabbitMqPersistentConnections.GetConnections().ForEach(conn =>
eventBuses.Add(new EventBusRabbitMQ(multiRabbitMqPersistentConnections.GetConnections()[0], logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount));
eventBuses.Add(new EventBusRabbitMQ(multiRabbitMqPersistentConnections.GetConnections()[1], logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantB", subscriptionClientName, retryCount));
/*multiRabbitMqPersistentConnections.GetConnections().ForEach(conn =>
{
eventBuses.Add(new EventBusRabbitMQ(conn, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount));
});
});*/
return new MultiEventBusRabbitMQ(eventBuses);
});
@ -389,7 +394,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
});*/
}
//}
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();


+ 4
- 4
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -311,7 +311,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
factory.Password = configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
@ -330,7 +330,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
{
var subscriptionClientName = configuration["SubscriptionClientName"];
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -344,7 +344,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -359,7 +359,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
retryCount = int.Parse(configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Location/Locations.API/Startup.cs View File

@ -91,7 +91,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
factory.Password = Configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -246,7 +246,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -259,7 +259,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -274,7 +274,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -115,7 +115,7 @@
factory.Password = Configuration["EventBusPassword"];
}
// factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -260,7 +260,7 @@
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -273,7 +273,7 @@
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -288,7 +288,7 @@
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -319,7 +319,7 @@
factory.Password = configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
@ -364,7 +364,7 @@
{
var subscriptionClientName = configuration["SubscriptionClientName"];
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -377,7 +377,7 @@
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -392,7 +392,7 @@
retryCount = int.Parse(configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 2
- 2
src/Services/Ordering/Ordering.API/appsettings.json View File

@ -6,10 +6,10 @@
"SeqServerUrl": null,
"LogstashgUrl": null,
"MinimumLevel": {
"Default": "Information",
"Default": "Verbose",
"Override": {
"Microsoft": "Warning",
"Microsoft.eShopOnContainers": "Information",
"Microsoft.eShopOnContainers": "Verbose",
"System": "Warning"
}
}


+ 5
- 3
src/Services/Ordering/Ordering.BackgroundTasks/Startup.cs View File

@ -81,6 +81,8 @@ namespace Ordering.BackgroundTasks
{
factory.Password = Configuration["EventBusPassword"];
}
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -123,7 +125,7 @@ namespace Ordering.BackgroundTasks
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -136,7 +138,7 @@ namespace Ordering.BackgroundTasks
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -151,7 +153,7 @@ namespace Ordering.BackgroundTasks
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Ordering/Ordering.SignalrHub/Startup.cs View File

@ -94,7 +94,7 @@ namespace Ordering.SignalrHub
factory.Password = Configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -195,7 +195,7 @@ namespace Ordering.SignalrHub
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -208,7 +208,7 @@ namespace Ordering.SignalrHub
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -223,7 +223,7 @@ namespace Ordering.SignalrHub
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Payment/Payment.API/Startup.cs View File

@ -72,7 +72,7 @@ namespace Payment.API
factory.Password = Configuration["EventBusPassword"];
}
// factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
@ -140,7 +140,7 @@ namespace Payment.API
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -153,7 +153,7 @@ namespace Payment.API
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -168,7 +168,7 @@ namespace Payment.API
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/TenantCustomisations/TenantACustomisations/Startup.cs View File

@ -311,7 +311,7 @@
factory.Password = configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
@ -355,7 +355,7 @@
{
var subscriptionClientName = configuration["SubscriptionClientName"];
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -368,7 +368,7 @@
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -383,7 +383,7 @@
retryCount = int.Parse(configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}


+ 4
- 4
src/Services/Webhooks/Webhooks.API/Startup.cs View File

@ -232,7 +232,7 @@ namespace Webhooks.API
{
var subscriptionClientName = configuration["SubscriptionClientName"];
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
/* if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
{
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
{
@ -246,7 +246,7 @@ namespace Webhooks.API
});
}
else
else*/
{
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
@ -261,7 +261,7 @@ namespace Webhooks.API
retryCount = int.Parse(configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, "TenantA", subscriptionClientName, retryCount);
});
}
@ -336,7 +336,7 @@ namespace Webhooks.API
factory.Password = configuration["EventBusPassword"];
}
//factory.VirtualHost = "customisation";
factory.VirtualHost = "TenantA";
var retryCount = 5;
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))


Loading…
Cancel
Save