
Wolverine 3.13 added a new message transport for Amazon SNS with a big pull request from Luis Villalaz.
To get started, add this Nuget to your system:
dotnet add package WolverineFx.AmazonSns
Assuming that you have set up a shared AWS configuration or credential files, you can connect to SNS from Wolverine with this:
var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
// This does depend on the server having an AWS credentials file
// See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html for more information
opts.UseAmazonSnsTransport()
// Let Wolverine create missing topics and subscriptions as necessary
.AutoProvision();
}).StartAsync();
To set up message publishing with Wolverine, you can use all the standard Wolverine message routing configuration, but use the new ToSnsTopic() extension method like so:
var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.UseAmazonSnsTransport();
opts.PublishMessage<Message1>()
.ToSnsTopic("outbound1")
// Increase the outgoing message throughput, but at the cost
// of strict ordering
.MessageBatchMaxDegreeOfParallelism(Environment.ProcessorCount)
.ConfigureTopicCreation(conf =>
{
// Configure topic creation request...
});
}).StartAsync();
You can also configure subscriptions to SNS topics to Amazon SQS queues like this:
var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.UseAmazonSnsTransport()
// Without this, the SubscribeSqsQueue() call does nothing
.AutoProvision();
opts.PublishMessage<Message1>()
.ToSnsTopic("outbound1")
// Sets a subscriptions to be
.SubscribeSqsQueue("queueName",
config =>
{
// Configure subscription attributes
config.RawMessageDelivery = true;
});
}).StartAsync();
Summary
Right now Wolverine has support for publishing through Amazon SNS to Amazon SQS queues. I of course do expect additional use cases and further interoperability stories for this transport, but honestly, I just want to react to what folks have a demonstrated need for rather than building anything early. If you have a use case for Amazon SNS with Wolverine that isn’t already covered, please just engage with our community either on Wolverine’s GitHub repository or in our Discord room.
With Wolverine 3.13, our list of supported message brokers has grown to:
- Rabbit MQ — admittedly our most feature rich and mature transport simply due to how often it’s used
- Azure Service Bus
- Amazon SQS
- Google PubSub — also done through community pull requests
- Sql Server or PostgreSQL if you just don’t have a lot of messages, but don’t want to introduce new messaging infrastructure. You can also import messages from external database tables as a way to do durable messaging from legacy systems to Wolverine.
- MQTT for IoT usage
- Kafka — which has also been improved through recent community feedback and pull requests
- Apache Pulsar — same as Kafka, there’s suddenly been more community usage and contribution for this transport
I don’t know when and if there will be additional transports, but there are occasional requests for NATS.io or Redis. I think there’s some possibility of a SignalR transport coming out of JasperFx’s internal work on our forthcoming “CritterWatch” tool.