Support: 1-800-961-4454
Sales Chat

Rackspace Cloudvent Calendar Day 9: Cloud Queues: You’ve Got Messages!

In the spirit of the holiday season, I’m sharing some tips and features of our cloud that you may not know about. In this countdown I’ll have 24 posts for you, each covering a single topic or feature about Rackspace Cloud products. We’ll post one per day so keep checking back!

Cloud Queues is  FREE to use until January, so now is a great time to try out this new product powered by the OpenStack Marconi project. You can use both Producer-Consumer and Publisher-Subscriber scenarios with a single API. In this post, let’s look at creating a queue and putting a message on that queue.

To create a queue you just need a name for your queue. We’ll call ours “vogon”:

curl –s –X PUT–H “X-Auth-Token: $TOKEN”

Done! Now we have a Cloud Queue called “vogon” we can put messages on. Let’s add a message to the vogon queue (we can submit up to 10, but let’s just do one):

curl –s –X POST –d [{"ttl": 300, "body": {"client": "ArthurDent"}} –H “Content-type: application/json” –H “X-Auth-Token: $TOKEN”

Great! We have a message containing some information called ArthurDent in our Vogon queue.  To have our worker claim 10 messages from the queue, issue a POST request:

curl –s –X POST –H “X-Auth-Token: $TOKEN”

You can claim up to 20 messages. When a worker finishes processing a message, it should delete the message before the claim expires to ensure that the message is processed only once.

For more information on Cloud Queues, check out our API documentation.

About the Author

This is a post written and contributed by Hart Hoover.

Hart Hoover is a Cloud Strategist at Rackspace Hosting. Hoover started his career as a Racker in 2007 as a Linux Systems Administrator, providing technical support for dedicated servers. He moved to the cloud in 2009 to help design the Managed Cloud Servers support model. He has presented at various technical conferences, maintains and contributes to the Rackspace DevOps Blog, and advises Rackspace customers on best practices for cloud computing.

Racker Powered
©2016 Rackspace, US Inc.