GithubHelp home page GithubHelp logo

luxiaoyuan / spring-boot-aws-sns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dhruvesh-patel/spring-boot-aws-sns

0.0 1.0 0.0 59 KB

This repo demonstrates how to send email notification on existing AWS SNS using java spring boot application.

Java 92.67% Dockerfile 7.33%

spring-boot-aws-sns's Introduction

This repo demonstrates how to send email notification using AWS SNS and java spring boot application. Notifications are important aspect of software and easy / quick notification mechanism with AWS SNS offers ability to quickly develop notification service.

Pre-requisite:

  1. JDK 11
  2. Eclipse / IntelliJ IDE
  3. Maven (if not part of IDE already)
  4. Postman (Or swagger or browser - I prefer Postman)

Steps to Setup :

  1. Create AWS Free-tier Account using https://portal.aws.amazon.com/billing/signup.
- Create SNS Topic using AWS Console - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html (Go to section - Create an SNS Topic)
- Note down SNS topic ARN (you will need to update this in application.properties)
- Also Get Access key and secret access key from AWS control using https://aws.amazon.com/blogs/security/how-to-find-update-access-keys-password-mfa-aws-management-console/. (you will need to update this in application.properties)
  1. Clone the application
https://github.com/dhruvesh-patel/spring-boot-aws-sns.git
  1. Update application.properties with your own values (without this application will not build or start).
cloud.aws.credentials.accessKey=xxxxxx
cloud.aws.credentials.secretKey=xxxxxx
cloud.aws.topic.arn:xxxxxx
  1. Build and run the app using IDE / maven
mvn clean install 
mvn spring-boot:run
The app will start running - check app health using http://localhost:8721/health.
  1. Use REST API to add subscription to existing SNS Topic using your email.
GET http://localhost:8721/addSubscription/{email}

For example, http://localhost:8721/addSubscription/[email protected]
  1. Use below REST API to send notification to all emails that have subscribed to the topic.
GET http://localhost:8721/sendNotification

When you do this, SNS Topic will receive email subject and email body to all email that have subscribed to topic.

spring-boot-aws-sns's People

Contributors

dhruvesh-patel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.