Simple API to receive and manage SNS test notifications. It could be very useful in integration tests to assert if SNS subscribers are receiving the expected notifications. The introductional blog post can be found here.
The setup consists of 3 simple steps.
Add the following into your docker-compose.yml
file:
sns-test-receiver:
image: ignassakalauskas/sns-test-receiver:latest
container_name: sns-test-receiver
ports:
- "5000:5000"
Add SnsTestReceiver
as SNS subscriber using HTTP protocol. For example, when using Localstack and AWS CLI:
awslocal sns create-topic --name api-notifications
awslocal sns subscribe --topic-arn "arn:aws:sns:eu-west-1:000000000000:notifications" --protocol http --notification-endpoint http://sns-test-receiver:5000/messages
Install the SnsTestReceiver.Sdk NuGet package into your test project.
dotnet add package SnsTestReceiver.Sdk
See example
folder.
- If you use a different programming language, you can still use the
SnsTestReceiver
, however you need to write your own SDK.
- Specify
AuthenticationRegion
in AWS config - Make sure to confirm SNS subscriptions, e.g. use
ConfirmSubscriptionAsync()
in theSnsTestReceiver.Sdk
nuget package.