Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subscribing and getting notifications from SNS in angular5

Tags:

I am doing simple test application in Angular5 which will read notifications coming from Amazon SNS topic and will display it on the UI.

I will publish messages into topic manually. But the problem is How I can subscribe to it from Angular app using aws-sdk.

Thanks!

like image 835
Krishna Sharma Avatar asked Jul 13 '18 13:07

Krishna Sharma


People also ask

How do I subscribe to SNS email?

To subscribe an email address to an Amazon SNS topic using the AWS Management Console. Sign in to the Amazon SNS console . In the left navigation pane, choose Subscriptions. On the Subscriptions page, choose Create subscription.

Can CloudWatch subscribe to SNS?

Amazon CloudWatch uses Amazon SNS to send email. First, create and subscribe to an SNS topic. When you create a CloudWatch alarm, you can add this SNS topic to send an email notification when the alarm changes state.


1 Answers

You should use a webhook or an IOT topic or schedule lambda to do this. Since you are publishing the messages to SNS topic that topic should be subscribed to the so called Lambda function of yours. After that from the application side you have to trigger the lambda function whenever there is a message from the SNS topic. Therefore from the application side we should have a lambda which is scheduled for a specific time(5 minutes) otherwise we would not get triggered when the SNS message data which has been transferred into lambda function.

Instead of using schedule lambda we can use a webhook or IOT topic where we subscribe to it and the lambda which was subscribed to the SNS topic will publish it's data/messages to the webhook or IOT topic. Therefore soon after the publish of data on IOT or webhook, from the application side we always have a subscription to it and we will receive the data in real time.

like image 115
SamPiy93 Avatar answered Oct 11 '22 17:10

SamPiy93