Project for sending notifications to a topic SNS using SpringBoot.
This project makes use of the custom-logging-starter library developed for sending logs to Logstash and/or AWS Kinesis.
Messages sent to the SNS are encapsulated with the automatically generated traceId and spandId and can be injected into the MDC of the application that consumes the message. [See: SQS Consumer]
Build the application to generate the *.jar artifact.
$ ./mvnw clean package
Generate the application docker image.
$ cd docker-compose/
$ docker-compose build sns-producer
Run localstack and application containers using docker-compose.
$ docker-compose up -d
Create the SNS topic for sending notifications.
$ aws --endpoint-url=http://localhost:4566 sns create-topic --name add-foobar-topic
Send a request.
$ curl -X POST \
--header 'content-type: application/json' \
--url http://localhost:8080/v1/foobar/add \
--data '{"foo": "1234567890","bar": "12345678000190","value": 123.45}' \
-w "%{http_code}\n"