AzureEventBus<TMarker> Class
Definition
- Assemblies
- Savvyio.Extensions.DependencyInjection.QueueStorage.dll
Provides a default implementation of the AzureEventBus class that is optimized for Dependency Injection.
public class AzureEventBus<TMarker> : AzureEventBus, IHealthCheckProvider<Uri>, IPublishSubscribeChannel<IIntegrationEvent, TMarker>, IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent, TMarker>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent, TMarker>, ISubscriber<IIntegrationEvent>, IDependencyInjectionMarker<TMarker>
Type Parameters
TMarker
- Inheritance
-
objectAzureEventBus<TMarker>
- Implements
-
IPublishSubscribeChannel<IIntegrationEvent, TMarker>IPublisher<IIntegrationEvent, TMarker>ISubscriber<IIntegrationEvent, TMarker>IDependencyInjectionMarker<TMarker>
- Inherited Members
Examples
AzureEventBus<TMarker> is the DI-registered Azure Queue Storage event bus with a lifetime marker. It implements IPublishSubscribeChannel<IIntegrationEvent>. Inject it to subscribe to and publish integration events through an Azure Storage queue.
using System;
using System.Threading.Tasks;
using Savvyio.EventDriven;
using Savvyio.Extensions.QueueStorage.EventDriven;
using Savvyio.Messaging;
namespace ExampleApp;
public sealed class EventListener
{
public static async Task SubscribeAsync(AzureEventBus bus)
{
await bus.SubscribeAsync(async (message, token) =>
{
Console.WriteLine($"Received event: {message.Type}");
await Task.CompletedTask;
}).ConfigureAwait(false);
}
}
Constructors
| Name | Description |
|---|---|
| AzureEventBus(IMarshaller, AzureQueueOptions<TMarker>, AzureEventBusOptions<TMarker>) | Initializes a new instance of the AzureEventBus<TMarker> class. |
See Also
IPublishSubscribeChannel<TRequest, TMarker>