# Queues v1

## Setup

### Rackspace setup

The first step is to pass in your credentials and set up a client. For Rackspace users, you will need your username and API key:

    use OpenCloud\Rackspace;

    $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
      'username' => '{username}',
      'apiKey'   => '{apiKey}',
    ));

### OpenStack setup

If you’re an OpenStack user, you will also need to prove a few other configuration parameters:

    $client = new OpenCloud\OpenStack('{keystoneUrl}', array(
      'username' => '{username}',
      'password' => '{apiKey}',
      'tenantId' => '{tenantId}',
    ));

### Queues service

Now to instantiate the Queues service:

    $service = $client->queuesService('{catalogName}', '{region}', '{urlType}');

- `{catalogName}` is the name of the service as it appears in the service catalog. OpenStack users must set this value. For Rackspace users, a default will be provided if you pass in `null`.
- `{region}` is the region the service will operate in. For Rackspace users, you can select one of the following from the supported regions page.
- `{urlType}` is the type of URL to use, depending on which endpoints your catalog provides. If omitted, it will default to the public network.

## Operations

- Queues
  - A note on Client IDs
  - List queues
    - Filtering lists
  - Create queue
  - Find queue details
  - Check queue existence
  - Update queue metadata
  - Retrieve the queue metadata
  - Get queue stats
  - Delete queue
- Messages
  - Setup
  - Post new message
    - Posting a single message
    - Post a batch of messages
  - Get messages
    - Parameters
  - Get a set of messages by ID
    - Parameters
  - Delete a set of messages by ID
  - Get a specific message
  - Delete message
- Claims
  - Setup
  - Claim messages
    - Parameters
  - Query claim
  - Update claim
  - Release claim

## Glossary

claim
  A Claim is the process of a worker checking out a message to perform a task. Claiming a message prevents other workers from attempting to process the same messages.
queue
  A Queue is an entity that holds messages. Ideally, a queue is created per work type. For example, if you want to compress files, you would create a queue dedicated to this job. Any application that reads from this queue would only compress files.
message
  A Message is a task, a notification, or any meaningful data that a producer or publisher sends to the queue. A message exists until it is deleted by a recipient or automatically by the system based on a TTL (time-to-live) value.

## Further links

- Getting Started Guide for the API
- API Developer Guide
- API release history