Service/Amazon/Sqs.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Service
- subpackage
- Amazon_Sqs
- version
- $Id: Sqs.php 24470 2011-09-26 16:26:44Z ezimuel $
\Zend_Service_Amazon_Sqs
Class for connecting to the Amazon Simple Queue Service (SQS)
- Extends from
- \Zend_Service_Amazon_Abstract
- see
- \http://aws.amazon.com/sqs/
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Service
- subpackage
- Amazon_Sqs
Constants


CREATE_TIMEOUT_DEFAULT
= '30'
Default timeout for createQueue() function
Properties



$_sqsEndpoint= 'queue.amazonaws.com'
HTTP end point for the Amazon SQS service
Default valuequeue.amazonaws.com
Details
- Type



$_sqsSignatureMethod= 'HmacSHA256'
Signature Encoding Method
Default valueHmacSHA256
Details
- Type
Methods



_makeRequest(
$queue_url, string $action, array $params
=
array
)
:
\SimpleXMLElement
Make a request to Amazon SQS
Parameters
Name |
Type |
Description |
$queue_url |
|
|
$action |
string |
SQS action |
$params |
array |
|
Returns



_signParameters(
string $queue_url, $paramaters
)
:
string
Computes the RFC 2104-compliant HMAC signature for request parameters
This implements the Amazon Web Services signature, as per the following
specification:
Sort all request parameters (including SignatureVersion and
excluding Signature, the value of which is being created),
ignoring case.
Iterate over the sorted list and append the parameter name (in its
original case) and then its value. Do not URL-encode the parameter
values before constructing this string. Do not use any separator
characters when appending strings.
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
$paramaters |
|
|
Returns
Type |
Description |
string |
the signed data. |



addRequiredParameters(
string $queue_url, array $parameters
)
:
array
Adds required authentication and version parameters to an array of
parameters
The required parameters are:
- AWSAccessKey
- SignatureVersion
- Timestamp
- Version and
- Signature
If a required parameter is already set in the $parameters array,
it is overwritten.
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
$parameters |
array |
the array to which to add the required parameters. |
Returns



count(
string $queue_url
)
:
integer
Return the approximate number of messages in the queue
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
Returns
Throws



delete(
string $queue_url
)
:
boolean
Delete a queue and all of it's messages
Returns false if the queue is not found, true if the queue exists
Parameters
Name |
Type |
Description |
$queue_url |
string |
queue URL |
Returns
Throws



deleteMessage(
string $queue_url, string $handle
)
:
boolean
Delete a message from the queue
Returns true if the message is deleted, false if the deletion is
unsuccessful.
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
$handle |
string |
Message handle as returned by SQS |
Returns
Throws



getAttribute(
string $queue_url, string $attribute
=
All
)
:
string
Get the attributes for the queue
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
$attribute |
string |
|
Returns
Throws



getEndpoints(
)
:
array
Get possible SQS endpoints
Since there is not an SQS webserive to get all possible endpoints, a hardcoded list is available.
For the actual region list please check:
http://docs.amazonwebservices.com/AWSSimpleQueueService/2009-02-01/APIReference/index.html?QueueServiceWsdlArticle.html
Returns



receive(
string $queue_url, integer $max_messages
=
null, integer $timeout
=
null
)
:
array
Get messages in the queue
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue name |
$max_messages |
integer |
Maximum number of messages to return |
$timeout |
integer |
Visibility timeout for these messages |
Returns
Throws



send(
string $queue_url, string $message
)
:
string
Send a message to the queue
Parameters
Name |
Type |
Description |
$queue_url |
string |
Queue URL |
$message |
string |
Message to send to the queue |
Returns
Type |
Description |
string |
Message ID |
Throws