PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Instantiating and Configuring QueueService Adapters

To instantiate a QueueService adapter, use the static method Zend_Cloud_QueueService_Factory::getAdapter(), which accepts either an array or a Zend_Config object. Three parameters apply to all adapters, while the remaining parameters are adapter-specific properties; these adapter-specific properties often contain access details.

The general parameters are as follows:

  • queue_adapter specifies the concrete adapter class;

  • message_class specifies the class to use to represent queue messages; defaults to Zend_Cloud_QueueService_Message; and

  • messageset_class specifies the class to use to represent collections of queue messages; defaults to Zend_Cloud_QueueService_MesageSet.

Example 86. Instantiating an Amazon SQS adapter via the factory

<?php
$queues 
Zend_Cloud_QueueService_Factory::getAdapter(array(
    
Zend_Cloud_QueueService_Factory::QUEUE_ADAPTER_KEY  => 'Zend_Cloud_QueueService_Adapter_Sqs',
    
Zend_Cloud_QueueService_Adapter_Sqs::AWS_ACCESS_KEY => $amazonKey,
    
Zend_Cloud_QueueService_Adapter_Sqs::AWS_SECRET_KEY => $amazonSecret,
));

Service-Specific Options

Table 35. Zend_Cloud_QueueService_Adapter_Sqs Options

Option key Description Used in Required Default
aws_accesskey Your Amazon AWS access key Constructor Yes None
aws_secretkey Your Amazon AWS secret key Constructor Yes None
http_adapter HTTP adapter to use in all access operations Constructor No Zend_Http_Client_Adapter_Socket
http_adapter HTTP adapter to use in all access operations Constructor No Zend_Http_Client_Adapter_Socket
visibility_timeout Message visibility timeout receiveMessages() No 60

Table 36. Zend_Cloud_QueueService_Adapter_WindowsAzure Options

Option key Description Used in Required Default
storage_accountname Windows Azure account name Constructor Yes None
storage_accountkey Windows Azure account key Constructor Yes None
storage_host Windows Azure access host Constructor No queue.core.windows.net
storage_proxy_host Proxy hostname Constructor No None
storage_proxy_port Proxy port Constructor No 8080
storage_proxy_credentials Proxy credentials Constructor No None
http_adapter HTTP adapter to use in all access operations Constructor No Zend_Http_Client_Adapter_Socket
visibility_timeout Message visibility timeout receiveMessages() No 60
prefix Filter the results to only queue names beginning with given prefix listQueues() No None
max_results Limit queue list to certain number of results listQueues() No 5,000
ttl Set time-to-live for message sendMessage() No 7 days

Table 37. Zend_Cloud_QueueService_Adapter_ZendQueue Options

Option key Description Used in Required Default
adapter Concrete Zend_Queue adapter to use. See the Zend_Queue documentation for supported adapters and their options. Constructor No Filesystem
timeout Visibility timeout for messages createQueue(), receiveMessages() No 30

Zend Framework