简体   繁体   中英

How to send multiple emails using Amazon SQS and SNS?

In my JAVA application, I'm using Amazon SQS and SNS; I did the below steps:

Step 1: I pushed the message to SQS like,

SendMessageResult aSendMessageStatus = Amazon_SQS_Client.sendMessage(new SendMessageRequest().withQueueUrl(AWS_SQS_URL).withMessageBody(theRequestString));

Step 2: Created topic in SNS like,

CreateTopicResult createRes = Amazon_SNS_Client.createTopic(createReq);

Step 3: Now I am trying to send email by receiving the messages from SQS to 100 of customer.

Can someone advice me on how to subscribe the topic in SNS and send the emails to multiple email addresses.

For SNS to deliver the message, the 100 email address would have to subscribe to the topic. The email address will get confirmation message which they will have to respond to.

For your scenario, another option could be to use the queue service. It can be done in multiple ways. I have a setup as follows:

  1. An application component sends a message to a queue
  2. Another application component polls the queue, retrieves the message
  3. From the message an email is composed and use SES service to deliver emails.

Another option is to use SNS -> SQS -> SES setup, where initial notification goes to SNS, and SNS delivers the notification to SQS.

The notification message itself need not be the complete email message. It could be just a reference to the content and people to which the content is to be delivered. Your application could take care of forming the complete message.

For a scenario where email is delivered to a general application user, I think SES is the right solution rather than SNS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM