From 6c56929667e074a4839761c589bbee019a52984a Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 17 Apr 2014 15:42:32 -0400 Subject: [PATCH 1/2] Updating the queues docs. listing of queue resources is now possible. --- docs/queues.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/queues.md b/docs/queues.md index 6c490181..8664b153 100644 --- a/docs/queues.md +++ b/docs/queues.md @@ -13,7 +13,7 @@ In both of these models, administrators can get queue statistics that display th ## Using Queues in pyrax Once you have authenticated, you can reference the Queues service via `pyrax.queues`. To make your coding easier, include the following line at the beginning of your code: - pq = pyrax.queues + pq = pyrax.QueueClient() Then you can simply use the alias `pq` to reference the service. All of the code samples in this document assume that `pq` has been defined this way. @@ -44,12 +44,16 @@ Queues require a unique name. If you try to create a queue with a name that alre queue = pq.create("my_unique_queue") -There is currently no way to list existing queues, so if you need to determine whether a queue by a specific name exists, call: +If you wish to check a given queue already exists, you may do so as follows: exists = pq.queue_exists("name_to_check") This call returns `True` or `False`, depending on the existence of a queue with the given name. +## Listing queues +The code below shows how you can list all the queues in a given region: + + qs = pyrax.queues.list() ## Posting a Message to a Queue Messages can be any type of data, as long as they do not exceed 256 KB in length. The message body can be simple values, or a chunk of XML, or a list of JSON values, or anything else. pyrax handles the JSON-encoding required to post the message. From e7609dca7558142a94baf5703e249dd002662d0a Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 17 Apr 2014 16:12:29 -0400 Subject: [PATCH 2/2] Fixing code inaccuracy. --- docs/queues.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/queues.md b/docs/queues.md index 8664b153..05cbe0bf 100644 --- a/docs/queues.md +++ b/docs/queues.md @@ -13,7 +13,7 @@ In both of these models, administrators can get queue statistics that display th ## Using Queues in pyrax Once you have authenticated, you can reference the Queues service via `pyrax.queues`. To make your coding easier, include the following line at the beginning of your code: - pq = pyrax.QueueClient() + pq = pyrax.queues Then you can simply use the alias `pq` to reference the service. All of the code samples in this document assume that `pq` has been defined this way.