Browse Source

Renaming.

pull/126/head
dsanz 8 years ago
parent
commit
254d479582
6 changed files with 13 additions and 13 deletions
  1. +3
    -3
      src/Services/Basket/Basket.API/Events/CatalogPriceChangedHandler.cs
  2. +4
    -4
      src/Services/Basket/Basket.API/Startup.cs
  3. +1
    -1
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  4. +1
    -1
      src/Services/Catalog/Catalog.API/Startup.cs
  5. +2
    -2
      src/Services/Common/Infrastructure/Catalog/ProductPriceChanged.cs
  6. +2
    -2
      src/Services/Common/Infrastructure/EventBusRabbitMQ.cs

+ 3
- 3
src/Services/Basket/Basket.API/Events/CatalogPriceChangedHandler.cs View File

@ -8,15 +8,15 @@ using System.Threading.Tasks;
namespace Basket.API.Events
{
public class CatalogPriceChangedHandler : IIntegrationEventHandler<CatalogPriceChanged>
public class ProductPriceChangedHandler : IIntegrationEventHandler<ProductPriceChanged>
{
private readonly IBasketRepository _repository;
public CatalogPriceChangedHandler(IBasketRepository repository)
public ProductPriceChangedHandler(IBasketRepository repository)
{
_repository = repository;
}
public async Task Handle(CatalogPriceChanged @event)
public async Task Handle(ProductPriceChanged @event)
{
var userIds = await _repository.GetUsers();
foreach (var id in userIds)


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

@ -79,16 +79,16 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
});
services.AddTransient<IBasketRepository, RedisBasketRepository>();
services.AddTransient<IIntegrationEventHandler<CatalogPriceChanged>, CatalogPriceChangedHandler>();
services.AddTransient<IIntegrationEventHandler<ProductPriceChanged>, ProductPriceChangedHandler>();
var serviceProvider = services.BuildServiceProvider();
var configuration = serviceProvider.GetRequiredService<IOptionsSnapshot<BasketSettings>>().Value;
var eventBus = new EventBus(configuration.EventBusConnection);
var eventBus = new EventBusRabbitMQ(configuration.EventBusConnection);
services.AddSingleton<IEventBus>(eventBus);
var catalogPriceHandler = serviceProvider.GetService<IIntegrationEventHandler<CatalogPriceChanged>>();
eventBus.Subscribe<CatalogPriceChanged>(catalogPriceHandler);
var catalogPriceHandler = serviceProvider.GetService<IIntegrationEventHandler<ProductPriceChanged>>();
eventBus.Subscribe<ProductPriceChanged>(catalogPriceHandler);
}


+ 1
- 1
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -149,7 +149,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
_context.CatalogItems.Update(item);
await _context.SaveChangesAsync();
var @event = new CatalogPriceChanged(item.Id, item.Price, oldPrice);
var @event = new ProductPriceChanged(item.Id, item.Price, oldPrice);
await ProcessEventAsync(@event);
}


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

@ -77,7 +77,7 @@
var serviceProvider = services.BuildServiceProvider();
var configuration = serviceProvider.GetRequiredService<IOptionsSnapshot<Settings>>().Value;
services.AddSingleton<IEventBus>(new EventBus(configuration.EventBusConnection));
services.AddSingleton<IEventBus>(new EventBusRabbitMQ(configuration.EventBusConnection));
services.AddMvc();
}


src/Services/Common/Infrastructure/Catalog/CatalogPriceChanged.cs → src/Services/Common/Infrastructure/Catalog/ProductPriceChanged.cs View File

@ -4,7 +4,7 @@ using System.Text;
namespace Microsoft.eShopOnContainers.Services.Common.Infrastructure.Catalog
{
public class CatalogPriceChanged : IntegrationEventBase
public class ProductPriceChanged : IntegrationEventBase
{
public int ItemId { get; private set; }
@ -12,7 +12,7 @@ namespace Microsoft.eShopOnContainers.Services.Common.Infrastructure.Catalog
public decimal OldPrice { get; set; }
public CatalogPriceChanged(int itemId, decimal newPrice, decimal oldPrice)
public ProductPriceChanged(int itemId, decimal newPrice, decimal oldPrice)
{
ItemId = itemId;
NewPrice = newPrice;

src/Services/Common/Infrastructure/EventBus.cs → src/Services/Common/Infrastructure/EventBusRabbitMQ.cs View File

@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Common.Infrastructure
{
public class EventBus : IEventBus
public class EventBusRabbitMQ : IEventBus
{
private readonly string _brokerName = "event_bus";
private readonly string _connectionString;
@ -24,7 +24,7 @@ namespace Microsoft.eShopOnContainers.Services.Common.Infrastructure
private string _queueName;
public EventBus(string connectionString)
public EventBusRabbitMQ(string connectionString)
{
_connectionString = connectionString;
_handlers = new Dictionary<string, List<IIntegrationEventHandler>>();

Loading…
Cancel
Save