File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99namespace Basket . API . Events
1010{
11- public class CatalogPriceChangedHandler : IIntegrationEventHandler < CatalogPriceChanged >
11+ public class ProductPriceChangedHandler : IIntegrationEventHandler < ProductPriceChanged >
1212 {
1313 private readonly IBasketRepository _repository ;
14- public CatalogPriceChangedHandler ( IBasketRepository repository )
14+ public ProductPriceChangedHandler ( IBasketRepository repository )
1515 {
1616 _repository = repository ;
1717 }
1818
19- public async Task Handle ( CatalogPriceChanged @event )
19+ public async Task Handle ( ProductPriceChanged @event )
2020 {
2121 var userIds = await _repository . GetUsers ( ) ;
2222 foreach ( var id in userIds )
Original file line number Diff line number Diff line change @@ -79,16 +79,16 @@ public void ConfigureServices(IServiceCollection services)
7979 } ) ;
8080
8181 services . AddTransient < IBasketRepository , RedisBasketRepository > ( ) ;
82- services . AddTransient < IIntegrationEventHandler < CatalogPriceChanged > , CatalogPriceChangedHandler > ( ) ;
82+ services . AddTransient < IIntegrationEventHandler < ProductPriceChanged > , ProductPriceChangedHandler > ( ) ;
8383
8484 var serviceProvider = services . BuildServiceProvider ( ) ;
8585 var configuration = serviceProvider . GetRequiredService < IOptionsSnapshot < BasketSettings > > ( ) . Value ;
86- var eventBus = new EventBus ( configuration . EventBusConnection ) ;
86+ var eventBus = new EventBusRabbitMQ ( configuration . EventBusConnection ) ;
8787 services . AddSingleton < IEventBus > ( eventBus ) ;
8888
8989
90- var catalogPriceHandler = serviceProvider . GetService < IIntegrationEventHandler < CatalogPriceChanged > > ( ) ;
91- eventBus . Subscribe < CatalogPriceChanged > ( catalogPriceHandler ) ;
90+ var catalogPriceHandler = serviceProvider . GetService < IIntegrationEventHandler < ProductPriceChanged > > ( ) ;
91+ eventBus . Subscribe < ProductPriceChanged > ( catalogPriceHandler ) ;
9292
9393 }
9494
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ public async Task<IActionResult> Post([FromBody]CatalogItem value)
149149 _context . CatalogItems . Update ( item ) ;
150150 await _context . SaveChangesAsync ( ) ;
151151
152- var @event = new CatalogPriceChanged ( item . Id , item . Price , oldPrice ) ;
152+ var @event = new ProductPriceChanged ( item . Id , item . Price , oldPrice ) ;
153153 await ProcessEventAsync ( @event ) ;
154154 }
155155
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public void ConfigureServices(IServiceCollection services)
7777
7878 var serviceProvider = services . BuildServiceProvider ( ) ;
7979 var configuration = serviceProvider . GetRequiredService < IOptionsSnapshot < Settings > > ( ) . Value ;
80- services . AddSingleton < IEventBus > ( new EventBus ( configuration . EventBusConnection ) ) ;
80+ services . AddSingleton < IEventBus > ( new EventBusRabbitMQ ( configuration . EventBusConnection ) ) ;
8181
8282 services . AddMvc ( ) ;
8383 }
Original file line number Diff line number Diff line change 44
55namespace Microsoft . eShopOnContainers . Services . Common . Infrastructure . Catalog
66{
7- public class CatalogPriceChanged : IntegrationEventBase
7+ public class ProductPriceChanged : IntegrationEventBase
88 {
99 public int ItemId { get ; private set ; }
1010
1111 public decimal NewPrice { get ; private set ; }
1212
1313 public decimal OldPrice { get ; set ; }
1414
15- public CatalogPriceChanged ( int itemId , decimal newPrice , decimal oldPrice )
15+ public ProductPriceChanged ( int itemId , decimal newPrice , decimal oldPrice )
1616 {
1717 ItemId = itemId ;
1818 NewPrice = newPrice ;
Original file line number Diff line number Diff line change 1313
1414namespace Microsoft . eShopOnContainers . Services . Common . Infrastructure
1515{
16- public class EventBus : IEventBus
16+ public class EventBusRabbitMQ : IEventBus
1717 {
1818 private readonly string _brokerName = "event_bus" ;
1919 private readonly string _connectionString ;
@@ -24,7 +24,7 @@ public class EventBus : IEventBus
2424 private string _queueName ;
2525
2626
27- public EventBus ( string connectionString )
27+ public EventBusRabbitMQ ( string connectionString )
2828 {
2929 _connectionString = connectionString ;
3030 _handlers = new Dictionary < string , List < IIntegrationEventHandler > > ( ) ;
You can’t perform that action at this time.
0 commit comments