pyrax
Python Bindings for the Rackspace Cloud
 All Classes Namespaces Files Functions Variables Properties
Public Member Functions | Public Attributes
Queue Class Reference

This class represents a Queue. More...

Inheritance diagram for Queue:
BaseResource

List of all members.

Public Member Functions

def __init__
def get_message
 Returns the message whose ID matches the supplied msg_id from this queue.
def delete_message
 Deletes the message whose ID matches the supplied msg_id from this queue.
def list
 Returns a list of messages for this queue.
def list_by_ids
 If you wish to retrieve a list of messages from this queue and know the IDs of those messages, you can pass in a list of those IDs, and only the matching messages will be returned.
def delete_by_ids
 Deletes the messages whose IDs are passed in from this queue.
def list_by_claim
 Returns a list of all the messages from this queue that have been claimed by the specified claim.
def post_message
 Create a message in this queue.
def claim_messages
 Claims up to `count` unclaimed messages from this queue.
def get_claim
 Returns a QueueClaim object with information about the specified claim.
def update_claim
 Updates the specified claim with either a new TTL or grace period, or both.
def release_claim
 Releases the specified claim and makes any messages previously claimed by this claim as available for processing by other workers.
def id
def id

Public Attributes

 name

Detailed Description

This class represents a Queue.


Constructor & Destructor Documentation

def __init__ (   self,
  manager,
  info,
  key = None,
  loaded = False 
)

Reimplemented from BaseResource.


Member Function Documentation

def claim_messages (   self,
  ttl,
  grace,
  count = None 
)

Claims up to `count` unclaimed messages from this queue.

If count is not specified, the default is to claim 10 messages.

The `ttl` parameter specifies how long the server should wait before releasing the claim. The ttl value MUST be between 60 and 43200 seconds.

The `grace` parameter is the message grace period in seconds. The value of grace MUST be between 60 and 43200 seconds. The server extends the lifetime of claimed messages to be at least as long as the lifetime of the claim itself, plus a specified grace period to deal with crashed workers (up to 1209600 or 14 days including claim lifetime). If a claimed message would normally live longer than the grace period, its expiration will not be adjusted.

Returns a QueueClaim object, whose 'messages' attribute contains the list of QueueMessage objects representing the claimed messages.

def delete_by_ids (   self,
  ids 
)

Deletes the messages whose IDs are passed in from this queue.

def delete_message (   self,
  msg_id 
)

Deletes the message whose ID matches the supplied msg_id from this queue.

def get_claim (   self,
  claim 
)

Returns a QueueClaim object with information about the specified claim.

If no such claim exists, a NotFound exception is raised.

def get_message (   self,
  msg_id 
)

Returns the message whose ID matches the supplied msg_id from this queue.

def id (   self)
def id (   self,
  val 
)
def list (   self,
  include_claimed = False,
  echo = False,
  marker = None,
  limit = None 
)

Returns a list of messages for this queue.

By default only unclaimed messages are returned; if you want claimed messages included, pass `include_claimed=True`. Also, the requester's own messages are not returned by default; if you want them included, pass `echo=True`.

The 'marker' and 'limit' parameters are used to control pagination of results. 'Marker' is the ID of the last message returned, while 'limit' controls the number of messages returned per reuqest (default=20).

def list_by_claim (   self,
  claim 
)

Returns a list of all the messages from this queue that have been claimed by the specified claim.

The claim can be either a claim ID or a QueueClaim object.

def list_by_ids (   self,
  ids 
)

If you wish to retrieve a list of messages from this queue and know the IDs of those messages, you can pass in a list of those IDs, and only the matching messages will be returned.

This avoids pulling down all the messages in a queue and filtering on the client side.

def post_message (   self,
  body,
  ttl = None 
)

Create a message in this queue.

The 'ttl' parameter defaults to 14 days if not specified.

def release_claim (   self,
  claim 
)

Releases the specified claim and makes any messages previously claimed by this claim as available for processing by other workers.

def update_claim (   self,
  claim,
  ttl = None,
  grace = None 
)

Updates the specified claim with either a new TTL or grace period, or both.


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties