Amazon Simple Notification Service

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.

SNS overview

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", "dkavanagh@gmail.com");
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);

Amazon SQS adds new features

I haven’t seen this documented anywhere yet, but I got the following e-mail from Amazon;

Dear Amazon SQS Customer,

Today, we’ve augmented Amazon SQS with support for several new message attributes.

Amazon SQS now supports a new value – ApproximateNumberOfMessagesNotVisible – for the GetQueueAttributes’ AttributeName parameter. Calling GetQueueAttributes with this value will return the approximate number of messages that are not timed out and not deleted.

In addition, we’ve added new attributes supported by the ReceiveMessage API. ReceiveMessage’s AttributeName parameter list now includes three additional values – All, ApproximateReceiveCount, and ApproximateFirstReceiveTimestamp – which will allow you to receive additional message information as part of the call.

These new features are available with Amazon SQS WSDL 2009-02-01. If you’d like to take advantage of these new features, please review our Technical Documentation, which gives detailed information about the new APIs. Or refer to the What’s New post on the SQS Developer Guide.

Lastly, we’d like to provide an update on the “end-of-life” schedule for WSDL versions 2006-04-01 and 2007-05-01. As previously communicated, Amazon SQS users will have until November 6, 2009 to complete their migration to WSDL version 2009-02-01 or 2008-01-01, after which the old WSDL versions will no longer be available. We’ve provided some migration resources that will assist you in moving to the new WSDL.

We hope you enjoy these new features.

Sincerely,

The Amazon SQS Team