Class for connecting to the Amazon Simple Queue Service (SQS)
category | Zend |
---|---|
package | Zend_Service |
subpackage | Amazon_Sqs |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
see | Amazon Simple Queue Service |
inherited_from | \Zend_Service_Amazon_Abstract |
__construct(string $accessKey= null
, string $secretKey= null
, string $region= null
)
The default region is us-east-1. Use the region to set it to one of the regions that is build-in into ZF. To add a new AWS region use the setEndpoint() method.
inherited_from | \Zend_Service_Amazon_Abstract::__construct() |
---|
string
string
string
__construct($accessKey= null
, $secretKey= null
) : void
count(string $queue_url) : integer
string
Queue URL
\Zend_Service_Amazon_Sqs_Exception |
---|
integer
create(string $queue_name, integer $timeout = null
) : string | boolean
Visibility timeout is how long a message is left in the queue "invisible" to other readers. If the message is acknowleged (deleted) before the timeout, then the message is deleted. However, if the timeout expires then the message will be made available to other queue readers.
string
queue name
integer
default visibility timeout
\Zend_Service_Amazon_Sqs_Exception |
---|
string
boolean
delete(string $queue_url) : boolean
Returns false if the queue is not found, true if the queue exists
string
queue URL
\Zend_Service_Amazon_Sqs_Exception |
---|
boolean
deleteMessage(string $queue_url, string $handle) : boolean
Returns true if the message is deleted, false if the deletion is unsuccessful.
string
Queue URL
string
Message handle as returned by SQS
\Zend_Service_Amazon_Sqs_Exception |
---|
boolean
getAttribute(string $queue_url, string $attribute = 'All'
) : string
string
Queue URL
string
\Zend_Service_Amazon_Sqs_Exception |
---|
string
getEndpoint() : string
string
getEndpoints() : array
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
array
getHttpClient() : \Zend_Http_Client
\Zend_Http_Client
getQueues() : array
\Zend_Service_Amazon_Sqs_Exception |
---|
array
receive(string $queue_url, integer $max_messages= null
, integer $timeout= null
) : array
string
Queue name
integer
Maximum number of messages to return
integer
Visibility timeout for these messages
\Zend_Service_Amazon_Sqs_Exception |
---|
array
send(string $queue_url, string $message) : string
string
Queue URL
string
Message to send to the queue
\Zend_Service_Amazon_Sqs_Exception |
---|
string
Message IDsetEndpoint(string $region)
You can set SQS to on of the build-in regions. If the region does not exsist it will be added.
string
region
\Zend_Service_Amazon_Sqs_Exception |
---|
setHttpClient(\Zend_Http_Client $httpClient)
\Zend_Http_Client
setKeys($accessKey, $secretKey) : void
_getAccessKey() : string
string
_getSecretKey() : string
string
_setEndpoint(string $region)
Checks and sets endpoint if region exists in $_sqsEndpoints. If a new SQS region is added by amazon, please use the setEndpoint function to set it.
string
region
\Zend_Service_Amazon_Sqs_Exception |
---|
_signParameters(string $queue_url, array $paramaters) : string
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.
string
Queue URL
string
the signed data.addRequiredParameters(string $queue_url, array $parameters) : array
The required parameters are:
If a required parameter is already set in the $parameters array, it is overwritten.
string
Queue URL
array
the array to which to add the required parameters.
array
_makeRequest($queue_url, string $action, array $params = array()
) : \SimpleXMLElement
string
SQS action
array
\SimpleXMLElement
$_accessKey : string
$_defaultAccessKey : string
null
$_defaultSecretKey : string
null
$_httpClient : \Zend_Http_Client
null
$_secretKey : string
$_sqsApiVersion
'2009-02-01'
$_sqsEndpoint
'queue.amazonaws.com'
$_sqsEndpoints
array('us-east-1' => 'sqs.us-east-1.amazonaws.com', 'us-west-1' => 'sqs.us-west-1.amazonaws.com', 'eu-west-1' => 'sqs.eu-west-1.amazonaws.com', 'ap-southeast-1' => 'sqs.ap-southeast-1.amazonaws.com', 'ap-northeast-1' => 'sqs.ap-northeast-1.amazonaws.com')
$_sqsSignatureMethod
'HmacSHA256'
$_sqsSignatureVersion
'2'
CREATE_TIMEOUT_DEFAULT = 30