AmazonEventBus Class
Definition
- Namespace
- Savvyio.Extensions.SimpleQueueService.EventDriven
- Assemblies
- Savvyio.Extensions.SimpleQueueService.dll
Provides a default implementation of the AmazonBus<TRequest> class tailored for messages holding an IIntegrationEvent implementation.
public class AmazonEventBus : AmazonBus<IIntegrationEvent>, IConfigurable<AmazonMessageOptions>, IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent>, IHealthCheckProvider<IAmazonSimpleNotificationService>
- Inheritance
-
objectAmazonEventBus
- Implements
-
IHealthCheckProvider<IAmazonSimpleNotificationService>
- Derived
- Inherited Members
Examples
AmazonEventBus publishes and subscribes to integration events through Amazon SNS/SQS. Configure it with AmazonEventBusOptions and use it as IPublishSubscribeChannel<IIntegrationEvent>.
using System;
using Amazon;
using Amazon.Runtime;
using Savvyio.EventDriven;
using Savvyio.Extensions.SimpleQueueService.EventDriven;
using Savvyio.Messaging;
namespace ExampleApp;
public class SnsEventBusConfig
{
public static AmazonEventBusOptions CreateOptions() => new AmazonEventBusOptions { Credentials = new AnonymousAWSCredentials(), Endpoint = RegionEndpoint.EUWest1, SourceQueue = new Uri("https://sqs.eu-west-1.amazonaws.com/123456789012/events") };
public static IPublishSubscribeChannel<IIntegrationEvent> AsChannel(AmazonEventBus b) => b;
}
Constructors
| Name | Description |
|---|---|
| AmazonEventBus(IMarshaller, AmazonEventBusOptions) | Initializes a new instance of the AmazonEventBus class. |
Methods
| Name | Description |
|---|---|
| CreateSimpleNotificationServiceClient() | Creates the AWS SNS client used by publish operations. |
| GetHealthCheckTarget() | Returns a new Amazon.SimpleNotificationService.IAmazonSimpleNotificationService client instance configured for health probing of the underlying Amazon SNS service. |
| PublishAsync(IMessage<IIntegrationEvent>, Action<AsyncOptions>) | Publishes the specified |
| SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task>, Action<SubscribeAsyncOptions>) | Subscribe to one or more message(s) asynchronous using Publish-Subscribe Channel/Pub-Sub MEP. |