Class AmazonEventBus<TMarker>
- Assembly
- Savvyio.Extensions.DependencyInjection.SimpleQueueService.dll
Provides a default implementation of the AmazonBus<TRequest> class tailored for messages holding an IIntegrationEvent implementation.
public class AmazonEventBus<TMarker> : AmazonEventBus, IConfigurable<AmazonMessageOptions>, IHealthCheckProvider<IAmazonSimpleNotificationService>, IPublishSubscribeChannel<IIntegrationEvent, TMarker>, IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent, TMarker>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent, TMarker>, ISubscriber<IIntegrationEvent>, IDependencyInjectionMarker<TMarker>
Type Parameters
TMarker
- Inheritance
-
AmazonEventBus<TMarker>
- Implements
-
IHealthCheckProvider<IAmazonSimpleNotificationService>IPublishSubscribeChannel<IIntegrationEvent, TMarker>IPublisher<IIntegrationEvent, TMarker>ISubscriber<IIntegrationEvent, TMarker>IDependencyInjectionMarker<TMarker>
- Inherited Members
Examples
AmazonEventBus<TMarker> is the DI-registered Amazon SNS/SQS event bus with a lifetime marker. Inject it as IPublishSubscribeChannel<IIntegrationEvent> to publish events to an SNS topic and receive them via SQS.
using System;
using System.Threading.Tasks;
using Savvyio.EventDriven;
using Savvyio.Extensions.SimpleQueueService.EventDriven;
using Savvyio.Messaging;
namespace ExampleApp;
public sealed class SnsEventPublisher
{
private readonly IPublishSubscribeChannel<IIntegrationEvent> _bus;
public SnsEventPublisher(AmazonEventBus bus)
{
_bus = bus;
}
public Task PublishAsync(IMessage<IIntegrationEvent> message)
{
return _bus.PublishAsync(message);
}
}
Constructors
AmazonEventBus(IMarshaller, AmazonEventBusOptions<TMarker>)
Initializes a new instance of the AmazonEventBus<TMarker> class.
public AmazonEventBus(IMarshaller marshaller, AmazonEventBusOptions<TMarker> options)
Parameters
marshallerIMarshallerThe IMarshaller that is used when converting IIntegrationEvent implementations to messages.
optionsAmazonEventBusOptions<TMarker>The AmazonEventBusOptions<TMarker> used to configure this instance.
Exceptions
- ArgumentNullException
marshallercannot be null - or -optionscannot be null.- ArgumentException
optionsare not in a valid state.
See Also
IPublishSubscribeChannel<TRequest, TMarker>