Reduce the integration event name
This commit is contained in:
		
							parent
							
								
									767d3b252a
								
							
						
					
					
						commit
						975b85129e
					
				| @ -22,6 +22,7 @@ | |||||||
|         private readonly SubscriptionClient _subscriptionClient; |         private readonly SubscriptionClient _subscriptionClient; | ||||||
|         private readonly ILifetimeScope _autofac; |         private readonly ILifetimeScope _autofac; | ||||||
|         private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus"; |         private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus"; | ||||||
|  |         private const string INTEGRATION_EVENT_SUFIX = "IntegrationEvent"; | ||||||
| 
 | 
 | ||||||
|         public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,  |         public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,  | ||||||
|             ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, string subscriptionClientName, |             ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, string subscriptionClientName, | ||||||
| @ -41,7 +42,7 @@ | |||||||
| 
 | 
 | ||||||
|         public void Publish(IntegrationEvent @event) |         public void Publish(IntegrationEvent @event) | ||||||
|         { |         { | ||||||
|             var eventName = @event.GetType().Name; |             var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFIX, ""); | ||||||
|             var jsonMessage = JsonConvert.SerializeObject(@event); |             var jsonMessage = JsonConvert.SerializeObject(@event); | ||||||
|             var body = Encoding.UTF8.GetBytes(jsonMessage); |             var body = Encoding.UTF8.GetBytes(jsonMessage); | ||||||
| 
 | 
 | ||||||
| @ -69,7 +70,8 @@ | |||||||
|             where T : IntegrationEvent |             where T : IntegrationEvent | ||||||
|             where TH : IIntegrationEventHandler<T> |             where TH : IIntegrationEventHandler<T> | ||||||
|         { |         { | ||||||
|             var eventName = typeof(T).Name; |             var eventName =  typeof(T).Name.Replace(INTEGRATION_EVENT_SUFIX, ""); | ||||||
|  | 
 | ||||||
|             var containsKey = _subsManager.HasSubscriptionsForEvent<T>(); |             var containsKey = _subsManager.HasSubscriptionsForEvent<T>(); | ||||||
|             if (!containsKey) |             if (!containsKey) | ||||||
|             { |             { | ||||||
| @ -94,7 +96,7 @@ | |||||||
|             where T : IntegrationEvent |             where T : IntegrationEvent | ||||||
|             where TH : IIntegrationEventHandler<T> |             where TH : IIntegrationEventHandler<T> | ||||||
|         { |         { | ||||||
|             var eventName = typeof(T).Name; |             var eventName = typeof(T).Name.Replace(INTEGRATION_EVENT_SUFIX, ""); | ||||||
| 
 | 
 | ||||||
|             try |             try | ||||||
|             { |             { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user