Table of Contents

Class AmazonEventBus<TMarker>

Namespace
Savvyio.Extensions.DependencyInjection.SimpleQueueService.EventDriven
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>
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

marshaller IMarshaller

The IMarshaller that is used when converting IIntegrationEvent implementations to messages.

options AmazonEventBusOptions<TMarker>

The AmazonEventBusOptions<TMarker> used to configure this instance.

Exceptions

ArgumentNullException

marshaller cannot be null - or - options cannot be null.

ArgumentException

options are not in a valid state.

See Also