diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs index 7628f1db7..b5c8359b4 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs @@ -241,7 +241,7 @@ public class EventBusRabbitMQ : IEventBus, IDisposable if (_subsManager.HasSubscriptionsForEvent(eventName)) { - using var scope = _serviceProvider.CreateScope(); + await using var scope = _serviceProvider.CreateAsyncScope(); var subscriptions = _subsManager.GetHandlersForEvent(eventName); foreach (var subscription in subscriptions) { diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs index 46a5a1c64..0b350967d 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs @@ -151,7 +151,7 @@ public class EventBusServiceBus : IEventBus, IAsyncDisposable var processed = false; if (_subsManager.HasSubscriptionsForEvent(eventName)) { - var scope = _serviceProvider.CreateScope(); + await using var scope = _serviceProvider.CreateAsyncScope(); var subscriptions = _subsManager.GetHandlersForEvent(eventName); foreach (var subscription in subscriptions) {