Services_Amazon_SQS
[ class tree: Services_Amazon_SQS ] [ index: Services_Amazon_SQS ] [ all elements ]

Class: Services_Amazon_SQS

Source Location: /Services_Amazon_SQS-0.3.0/Services/Amazon/SQS.php

Class Overview


Abstract base class for interfacing with Amazon Simple Queue Service (SQS) queues


Author(s):

Copyright:

  • 2008 Mike Brittain, 2008 Amazon.com, 2008 silverorange

Variables

Methods


Child classes:

Services_Amazon_SQS_QueueManager
Class for creating, managing, and deleting Amazon Simple Queue Service (SQS) queues
Services_Amazon_SQS_Queue
A queue in the Amazon SQS

Inherited Variables

Inherited Methods


Class Details

[line 93]
Abstract base class for interfacing with Amazon Simple Queue Service (SQS) queues

This class uses the HTTP query mechanism for accessing the Amazon SQS. See page 20 of the Amazon SQS Developer's Guide PDF for details about the HTTP query mechanism.



[ Top ]


Class Variables

$account =  null

[line 127]

The account to use
  • Access: protected



[ Top ]

$maximumRetries =  10

[line 151]

The maximum number of retries to make when encountering internal errors on SQS

Type:   integer


[ Top ]

$request =  null

[line 141]

The HTTP request object to use

This can be specified in the constructor. Note: The request object is only used as a template to create other request objects. This prevents one API call from affecting the state of the HTTP request object for subsequent API calls.


Type:   HTTP_Request2


[ Top ]



Method Detail

addRequiredParameters   [line 349]

array addRequiredParameters( array $parameters)

Adds required authentication and version parameters to an array of parameters

The required parameters are:

  • AWSAccessKey,
  • Timestamp, and
  • Version.
If a required parameter is already set in the $parameters array, it is not overwritten.

  • Return: the parameters array, which includes the required parameters.
  • Access: protected

Parameters:

array   $parameters   —  the array to which to add the required parameters.

[ Top ]

getRequestBackoffTime   [line 478]

integer getRequestBackoffTime( integer $count)

Gets the number of milliseconds to wait before the next reqeust when performing exponential backoff

Exponential backoff is used when SQS encounters internal errors.

  • Return: the number of milliseconds to delay before the next request is attempted.
  • Access: protected

Parameters:

integer   $count   —  the number of the current attempt. Zero based.

[ Top ]

__construct (Constructor)   [line 172]

Services_Amazon_SQS __construct( Services_Amazon_SQS_Account|string $accessKey, [string $secretAccessKey = ''], [HTTP_Request2 $request = null])

Creates a new SQS client
  • Access: public

Overridden in child classes as:

Services_Amazon_SQS_Queue::__construct()
Creates a PHP SQS queue object

Parameters:

Services_Amazon_SQS_Account|string   $accessKey   —  either a Services_Amazon_SQS_Account object or a string containing the SQS access key for an account.
string   $secretAccessKey   —  if the first parameter is an account object, this parameter is ignored. Otherwise, this parameter is required and is the secret access key for the SQS account.
HTTP_Request2   $request   —  optional. The HTTP request object to use. If not specified, a HTTP request object is created automatically.

[ Top ]

isValidPermissionLabel   [line 453]

boolean isValidPermissionLabel( string $label)

Gets whether or not a permission label is valid

Amazon SQS permission labels must conform to the following rules:

  • must be 1 to 80 ASCII characters
  • must contain only alphanumeric characters, dashes (-), and underscores (_).

  • Return: true if the permission label is valid, otherwise false.
  • Access: protected

Parameters:

string   $label   —  the permission label to check.

[ Top ]

isValidVisibilityTimeout   [line 427]

boolean isValidVisibilityTimeout( integer $timeout)

Gets whether or not a visibility timeout is valid

Visibility timeouts must be between 0 and 7200 seconds.

  • Return: true if the timeout is valid, otherwise false.
  • Access: protected

Parameters:

integer   $timeout   —  the timeout value to check (in seconds).

[ Top ]

sendRequest   [line 264]

mixed sendRequest( [array $params = array()], [string $queueUrl = null])

Sends a HTTP request to the queue service

The supplied $params array should contain only the specific parameters for the request type and should not include account, signature, or timestamp related parameters. These parameters are added automatically.

  • Return: Services_Amazon_SQS_Response object or false if the request failed.
  • Throws: Services_Amazon_SQS_ErrorException if one or more errors are returned from Amazon.
  • Throws: Services_Amazon_SQS_HttpException if the HTTP request fails.
  • Access: protected

Parameters:

array   $params   —  optional. Array of request parameters for the API call.
string   $queueUrl   —  optional. The specific queue URL for which the request is made. Does not need to be specified for general actions like listing queues.

[ Top ]

setMaximumRetries   [line 233]

void setMaximumRetries( integer $retries)

Sets the maximum number of retries to make when encountering internal errors on SQS

Internal errors are handled using an exponential backoff algorithm so take care not to set this number too high. For example, a request requiring 20 retries will take approximately 17 minutes and 30 seconds to complete. Any number less than 10 is generally acceptable, incurring a maximum delay of just over 1 second.

The default value for Services_Amazon_SQS is 10 retries. Set to 0 to turn off exponential backoff altogether.

  • Access: public

Parameters:

integer   $retries   —  the maximum number of retries to make when encountering internal errors on SQS.

[ Top ]

setRequest   [line 207]

void setRequest( HTTP_Request2 $request)

Sets the HTTP request object to use
  • Access: public

Parameters:

HTTP_Request2   $request   —  the HTTP request object to use.

[ Top ]

signParameters   [line 383]

array signParameters( array $parameters, string $secretKey, string $url)

Signs an array of request parameters using the Amazon Web Services Signature Version 2 signing method

Parameters:

array   $parameters   —  the parameters for which to get the signature.
string   $secretKey   —  the secret key to use to sign the parameters.
string   $url   —  the request URI.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:35:28 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.