Amazon has just come out with yet another service to help build your app on AWS. Their Simple Notification Service is a pub/sub setup where you create topics and users can subscribe. Delivery is via a “push” mechanism, so subscribers won’t need to poll for new messages. Output can be one of several protocols which include http/https/email/email-json or sqs. While the e-mail output can be useful for managing things like users watching a comment or blog post. The other options are clearly geared towards consumption by other software. Imagine the http options being used to implement a web service callback. SQS is clearly helpful for building loosely coupled services in the cloud. Now, SNS can help feed into those services.
For more information, visit the SNS documentation
Jeff Barr also does an excellent job of describing SNS at the AWS blog.
typica now supports SNS. Subversion contains the latest code. A release will be coming shortly. (check this space for updates)
Here’s an example of how to use typica to create a topic, subscribe, send a message, then unsubscribe and remove the topic;
NotificationService sns = new NotificationService(props.getProperty("aws.accessId"), props.getProperty("aws.secretKey")); Result<String> ret = sns.createTopic("TestTopic"); String topicArn = ret.getResult(); System.err.println("topicArn: "+topicArn); sns.subscribe(topicArn, "email", "firstname.lastname@example.org"); System.out.println("Waiting till subscription is confirmed."); System.out.println("Check your e-mail, confirm, then press <return>"); System.in.read(); List<SubscriptionInfo> subs = sns.listSubscriptionsByTopic(topicArn, null).getItems(); String subArn = subs.get(0).getSubscriptionArn(); System.err.println("subscriptionArn: "+subArn); sns.publish(topicArn, TEST_MSG, "[SNS] testing..."); sns.unsubscribe(subArn); sns.deleteTopic(topicArn);
4 thoughts on “Amazon Simple Notification Service”
When can we expect support in Typica?
My fingers are itching to get rid of JMS alltogether and use SNS/SQS as a combo instead of Topics and Queues… 🙂
Thanks for Typica btw, very useful for me, and a lot of others I would presume.
I really want to add this into typica. I’ve been working on a new typica release for a while. Just trying to get through an issue I’m having with httpclient 4, then a release will come soon after… then new stuff like SNS.
Since i am using OnlineMQ.com, it would be nice to have it there as well