@@ -22,15 +22,15 @@ public class EventBusServiceBus : IEventBus
2222 private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus" ;
2323 private const string INTEGRATION_EVENT_SUFIX = "IntegrationEvent" ;
2424
25- public EventBusServiceBus ( IServiceBusPersisterConnection serviceBusPersisterConnection ,
25+ public EventBusServiceBus ( IServiceBusPersisterConnection serviceBusPersisterConnection ,
2626 ILogger < EventBusServiceBus > logger , IEventBusSubscriptionsManager subsManager , string subscriptionClientName ,
2727 ILifetimeScope autofac )
2828 {
2929 _serviceBusPersisterConnection = serviceBusPersisterConnection ;
3030 _logger = logger ;
3131 _subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager ( ) ;
3232
33- _subscriptionClient = new SubscriptionClient ( serviceBusPersisterConnection . ServiceBusConnectionStringBuilder ,
33+ _subscriptionClient = new SubscriptionClient ( serviceBusPersisterConnection . ServiceBusConnectionStringBuilder ,
3434 subscriptionClientName ) ;
3535 _autofac = autofac ;
3636
@@ -68,7 +68,7 @@ public void Subscribe<T, TH>()
6868 where T : IntegrationEvent
6969 where TH : IIntegrationEventHandler < T >
7070 {
71- var eventName = typeof ( T ) . Name . Replace ( INTEGRATION_EVENT_SUFIX , "" ) ;
71+ var eventName = typeof ( T ) . Name . Replace ( INTEGRATION_EVENT_SUFIX , "" ) ;
7272
7373 var containsKey = _subsManager . HasSubscriptionsForEvent < T > ( ) ;
7474 if ( ! containsKey )
@@ -81,7 +81,7 @@ public void Subscribe<T, TH>()
8181 Name = eventName
8282 } ) . GetAwaiter ( ) . GetResult ( ) ;
8383 }
84- catch ( ServiceBusException )
84+ catch ( ServiceBusException )
8585 {
8686 _logger . LogInformation ( $ "The messaging entity { eventName } already exists.") ;
8787 }
@@ -129,10 +129,9 @@ private void RegisterSubscriptionClientMessageHandler()
129129 {
130130 var eventName = $ "{ message . Label } { INTEGRATION_EVENT_SUFIX } ";
131131 var messageData = Encoding . UTF8 . GetString ( message . Body ) ;
132- var processed = await ProcessEvent ( eventName , messageData ) ;
133-
132+
134133 // Complete the message so that it is not received again.
135- if ( processed )
134+ if ( await ProcessEvent ( eventName , messageData ) )
136135 {
137136 await _subscriptionClient . CompleteAsync ( message . SystemProperties . LockToken ) ;
138137 }
@@ -197,4 +196,4 @@ private void RemoveDefaultRule()
197196 }
198197 }
199198 }
200- }
199+ }
0 commit comments