Previous Next

Adapters

Zend_Queue supports all queues implementing the interface Zend_Queue_Adapter_AdapterInterface. The following Message Queue services are supported:

Note: Limitations

Message transaction handling is not supported.

Specific Adapters - Configuration settings

If a default setting is indicated then the parameter is optional. If a default setting is not specified then the parameter is required.

Apache ActiveMQ - Zend_Queue_Adapter_Activemq

Options listed here are known requirements. Not all messaging servers require username or password.

  • $options['name'] = '/temp/queue1';

    This is the name of the queue that you wish to start using. (Required)

  • $options['driverOptions']['host'] = 'host.domain.tld';

    $options['driverOptions']['host'] = '127.0.0.1';

    You may set host to an IP address or a hostname.

    Default setting for host is '127.0.0.1'.

  • $options['driverOptions']['port'] = 61613;

    Default setting for port is 61613.

  • $options['driverOptions']['username'] = 'username';

    Optional for some messaging servers. Read the manual for your messaging server.

  • $options['driverOptions']['password'] = 'password';

    Optional for some messaging servers. Read the manual for your messaging server.

  • $options['driverOptions']['timeout_sec'] = 2;

    $options['driverOptions']['timeout_usec'] = 0;

    This is the amount of time that Zend_Queue_Adapter_Activemq will wait for read activity on a socket before returning no messages.

Db - Zend_Queue_Adapter_Db

Driver options are checked for a few required options such as type, host, username, password, and dbname. You may pass along additional parameters for Zend_DB::factory() as parameters in $options['driverOptions']. An example of an additional option not listed here, but could be passed would be port.

$options = array(
    'driverOptions' => array(
        'host'      => 'db1.domain.tld',
        'username'  => 'my_username',
        'password'  => 'my_password',
        'dbname'    => 'messaging',
        'type'      => 'pdo_mysql',
        'port'      => 3306, // optional parameter.
    ),
    'options' => array(
        // use Zend_Db_Select for update, not all databases can support this
        // feature.
        Zend_Db_Select::FOR_UPDATE => true
    )
);

// Create a database queue.
$queue = new Zend_Queue('Db', $options);
  • $options['name'] = 'queue1';

    This is the name of the queue that you wish to start using. (Required)

  • $options['driverOptions']['type'] = 'Pdo';

    type is the adapter you wish to have Zend_Db::factory() use. This is the first parameter for the Zend_Db::factory() class method call.

  • $options['driverOptions']['host'] = 'host.domain.tld';

    $options['driverOptions']['host'] = '127.0.0.1';

    You may set host to an IP address or a hostname.

    Default setting for host is '127.0.0.1'.

  • $options['driverOptions']['username'] = 'username';

  • $options['driverOptions']['password'] = 'password';

  • $options['driverOptions']['dbname'] = 'dbname';

    The database name that you have created the required tables for. See the notes section below.

MemcacheQ - Zend_Queue_Adapter_Memcacheq

  • $options['name'] = 'queue1';

    This is the name of the queue that you wish to start using. (Required)

  • $options['driverOptions']['host'] = 'host.domain.tld';

    $options['driverOptions']['host'] = '127.0.0.1;'

    You may set host to an IP address or a hostname.

    Default setting for host is '127.0.0.1'.

  • $options['driverOptions']['port'] = 22201;

    The default setting for port is 22201.

Zend Platform Job Queue - Zend_Queue_Adapter_PlatformJobQueue

  • $options['daemonOptions']['host'] = '127.0.0.1:10003';

    The hostname and port corresponding to the Zend Platform Job Queue daemon you will use. (Required)

  • $options['daemonOptions']['password'] = '1234';

    The password required for accessing the Zend Platform Job Queue daemon. (Required)

Array - Zend_Queue_Adapter_Array

  • $options['name'] = 'queue1';

    This is the name of the queue that you wish to start using. (Required)

Notes for Specific Adapters

The following adapters have notes:

Apache ActiveMQ

Visibility duration for Zend_Queue_Adapter_Activemq is not available.

While Apache's ActiveMQ will support multiple subscriptions, the Zend_Queue does not. You must create a new Zend_Queue object for each individual subscription.

ActiveMQ queue/topic names must begin with one of:

  • /queue/

  • /topic/

  • /temp-queue/

  • /temp-topic/

For example: /queue/testing

The following functions are not supported:

  • create() - create queue. Calling this function will throw an exception.

  • delete() - delete queue. Calling this function will throw an exception.

  • getQueues() - list queues. Calling this function will throw an exception.

Zend_Db

The database CREATE TABLE ( ... ) SQL statement can be found in Zend/Queue/Adapter/Db/mysql.sql.

MemcacheQ

Memcache can be downloaded from » http://www.danga.com/memcached/.

MemcacheQ can be downloaded from » http://memcachedb.org/memcacheq/.

  • deleteMessage() - Messages are deleted upon reception from the queue. Calling this function would have no effect. Calling this function will throw an error.

  • count() or count($adapter) - MemcacheQ does not support a method for counting the number of items in a queue. Calling this function will throw an error.

Zend Platform Job Queue

Job Queue is a feature of Zend Platform's Enterprise Solution offering. It is not a traditional message queue, and instead allows you to queue a script to execute, along with the parameters you wish to pass to it. You can find out more about Job Queue » on the zend.com website.

The following is a list of methods where this adapter's behavior diverges from the standard offerings:

  • create() - Zend Platform does not have the concept of discrete queues; instead, it allows administrators to provide scripts for processing jobs. Since adding new scripts is restricted to the administration interface, this method simply throws an exception indicating the action is forbidden.

  • isExists() - Just like create(), since Job Queue does not have a notion of named queues, this method throws an exception when invoked.

  • delete() - similar to create(), deletion of JQ scripts is not possible except via the admin interface; this method raises an exception.

  • getQueues() - Zend Platform does not allow introspection into the attached job handling scripts via the API. This method throws an exception.

  • count() - returns the total number of jobs currently active in the Job Queue.

  • send() - this method is perhaps the one method that diverges most from other adapters. The $message argument may be one of three possible types, and will operate differently based on the value passed:

    • string - the name of a script registered with Job Queue to invoke. If passed in this way, no arguments are provided to the script.

    • array - an array of values with which to configure a ZendApi_Job object. These may include the following:

      • script - the name of the Job Queue script to invoke. (Required)

      • priority - the job priority to use when registering with the queue.

      • name - a short string describing the job.

      • predecessor - the ID of a job on which this one depends, and which must be executed before this one may begin.

      • preserved - whether or not to retain the job within the Job Queue history. By default, off; pass a TRUE value to retain it.

      • user_variables - an associative array of all variables you wish to have in scope during job execution (similar to named arguments).

      • interval - how often, in seconds, the job should run. By default, this is set to 0, indicating it should run once, and once only.

      • end_time - an expiry time, past which the job should not run. If the job was set to run only once, and end_time has passed, then the job will not be executed. If the job was set to run on an interval, it will not execute again once end_time has passed.

      • schedule_time - a UNIX timestamp indicating when to run the job; by default, 0, indicating the job should run as soon as possible.

      • application_id - the application identifier of the job. By default, this is NULL, indicating that one will be automatically assigned by the queue, if the queue was assigned an application ID.

      As noted, only the script argument is required; all others are simply available to allow passing more fine-grained detail on how and when to run the job.

    • ZendApi_Job - finally, you may simply pass a ZendApi_Job instance, and it will be passed along to Platform's Job Queue.

    In all instances, send() returns a Zend_Queue_Message_PlatformJob object, which provides access to the ZendApi_Job object used to communicate with Job Queue.

  • receive() - retrieves a list of active jobs from Job Queue. Each job in the returned set will be an instance of Zend_Queue_Message_PlatformJob.

  • deleteMessage() - since this adapter only works with Job Queue, this method expects the provided $message to be a Zend_Queue_Message_PlatformJob instance, and will throw an exception otherwise.

Array (local)

The Array queue is a PHP array() in local memory. The Zend_Queue_Adapter_Array is good for unit testing.

Previous Next
Introdução ao Zend Framework
Resumo
Instalação
Conhecendo o Zend Framework
Guia Rápido do Zend Framework
Zend Framework & MVC Introduction
Create Your Project
Create A Layout
Create a Model and Database Table
Create A Form
Congratulations!
Auto-carregamento no Zend Framework
Introduction
Goals and Design
Basic Autoloader Usage
Resource Autoloading
Conclusion
Plugins no Zend Framework
Introduction
Using Plugins
Conclusion
Iniciando com o Zend_Layout
Introduction
Using Zend_Layout
Zend_Layout: Conclusions
Iniciando com os Marcadores do Zend_View
Introduction
Basic Placeholder Usage
Standard Placeholders
View Placeholders: Conclusion
Entendendo e Usando os Decoradores do Zend Form
Introduction
Decorator Basics
Layering Decorators
Rendering Individual Decorators
Creating and Rendering Composite Elements
Conclusion
Iniciando com o Zend_Session, Zend_Auth, e Zend_Acl
Building Multi-User Applications With Zend Framework
Managing User Sessions In ZF
Authenticating Users in Zend Framework
Building an Authorization System in Zend Framework
Iniciando com o Zend_Search_Lucene
Zend_Search_Lucene Introduction
Lucene Index Structure
Index Opening and Creation
Indexing
Searching
Supported queries
Search result pagination
Iniciando com o Zend_Paginator
Introduction
Simple Examples
Pagination Control and ScrollingStyles
Putting it all Together
Referência do Zend Framework
Zend_Acl
Introduction
Refining Access Controls
Advanced Usage
Zend_Amf
Introdução
Zend_Amf_Server
Zend_Application
Introdução
Zend_Application Quick Start
Theory of Operation
Examples
Core Functionality
Available Resource Plugins
Zend_Auth
Introduction
Database Table Authentication
Digest Authentication
HTTP Authentication Adapter
LDAP Authentication
Open ID Authentication
Zend_Barcode
Introdução
Criação de código de barras usando a classe Zend_Barcode
Objetos Zend_Barcode
Renderizadores do Zend_Barcode
Zend_Cache
Introduction
The Theory of Caching
Zend_Cache Frontends
Zend_Cache Backends
The Cache Manager
Zend_Captcha
Introdução
Captcha Operation
CAPTCHA Adapters
Zend_CodeGenerator
Introduction
Zend_CodeGenerator Examples
Zend_CodeGenerator Reference
Zend_Config
Introdução
Teoria de Operação
Zend_Config_Ini
Zend_Config_Xml
Zend_Config_Writer
Zend_Config_Writer
Zend_Console_Getopt
Introduction
Declaring Getopt Rules
Fetching Options and Arguments
Configuring Zend_Console_Getopt
Zend_Controller
Guia de Início Rápido do Zend_Controller
O Básico de Zend_Controller
O Front Controller
The Request Object
The Standard Router
The Dispatcher
Action Controllers
Action Helpers
The Response Object
Plugins
Using a Conventional Modular Directory Structure
MVC Exceptions
Zend_Currency
Introduction to Zend_Currency
Using Zend_Currency
Options for currencies
What makes a currency?
Where is the currency?
How does the currency look like?
How much is my currency?
Calculating with currencies
Exchanging currencies
Additional informations on Zend_Currency
Zend_Date
Introduction
Theory of Operation
Basic Methods
Zend_Date API Overview
Creation of Dates
Constants for General Date Functions
Working Examples
Zend_Db
Zend_Db_Adapter
Zend_Db_Statement
Zend_Db_Profiler
Zend_Db_Select
Zend_Db_Table
Zend_Db_Table_Row
Zend_Db_Table_Rowset
Zend_Db_Table Relationships
Zend_Db_Table_Definition
Zend_Debug
Dumping Variables
Zend_Dojo
Introduction
Zend_Dojo_Data: dojo.data Envelopes
Dojo View Helpers
Dojo Form Elements and Decorators
Zend_Dojo build layer support
Zend_Dom
Introdução
Zend_Dom_Query
Zend_Exception
Usando as Exceções
Uso básico
Exceções Anteriores
Zend_Feed
Introduction
Importing Feeds
Retrieving Feeds from Web Pages
Consuming an RSS Feed
Consuming an Atom Feed
Consuming a Single Atom Entry
Modifying Feed and Entry structures
Custom Feed and Entry Classes
Zend_Feed_Reader
Zend_Feed_Writer
Zend_Feed_Pubsubhubbub
Zend_File
Zend_File_Transfer
Validators for Zend_File_Transfer
Filters for Zend_File_Transfer
Zend_Filter
Introduction
Standard Filter Classes
Filter Chains
Writing Filters
Zend_Filter_Input
Zend_Filter_Inflector
Zend_Form
Zend_Form
Zend_Form Quick Start
Creating Form Elements Using Zend_Form_Element
Creating Forms Using Zend_Form
Creating Custom Form Markup Using Zend_Form_Decorator
Standard Form Elements Shipped With Zend Framework
Standard Form Decorators Shipped With Zend Framework
Internationalization of Zend_Form
Advanced Zend_Form Usage
Zend_Gdata
Introduction
Authenticating with AuthSub
Using the Book Search Data API
Authenticating with ClientLogin
Using Google Calendar
Using Google Documents List Data API
Using Google Health
Using Google Spreadsheets
Using Google Apps Provisioning
Using Google Base
Using Picasa Web Albums
Using the YouTube Data API
Catching Gdata Exceptions
Zend_Http
Introduction
Zend_Http_Client - Advanced Usage
Zend_Http_Client - Connection Adapters
Zend_Http_Cookie and Zend_Http_CookieJar
Zend_Http_Response
Zend_InfoCard
Introduction
Zend_Json
Introdução
Uso Básico
Uso Avançado do Zend_Json
Conversão de XML para JSON
Zend_Json_Server - JSON-RPC server
Zend_Layout
Introdução
Guia Rápido Zend_Layout
Opções de Configuração Zend_Layout
Uso Avançado de Zend_Layout
Zend_Ldap
Introduction
API overview
Usage Scenarios
Tools
Object oriented access to the LDAP tree using Zend_Ldap_Node
Getting information from the LDAP server
Serializing LDAP data to and from LDIF
Zend_Loader
Loading Files and Classes Dynamically
The Autoloader
Resource Autoloaders
Loading Plugins
Zend_Locale
Introduction
Using Zend_Locale
Normalization and Localization
Working with Dates and Times
Supported locales
Zend_Log
Overview
Writers
Formatters
Filters
Using the Factory to Create a Log
Zend_Mail
Introduction
Sending via SMTP
Sending Multiple Mails per SMTP Connection
Using Different Transports
HTML E-Mail
Attachments
Adding Recipients
Controlling the MIME Boundary
Additional Headers
Character Sets
Encoding
SMTP Authentication
Securing SMTP Transport
Reading Mail Messages
Zend_Markup
Introduction
Getting Started With Zend_Markup
Zend_Markup Parsers
Zend_Markup Renderers
Zend_Measure
Introduction
Creation of Measurements
Outputting measurements
Manipulating Measurements
Types of measurements
Zend_Memory
Overview
Memory Manager
Memory Objects
Zend_Mime
Zend_Mime
Zend_Mime_Message
Zend_Mime_Part
Zend_Navigation
Introduction
Pages
Containers
Zend_Oauth
Introduction to OAuth
Zend_OpenId
Introduction
Zend_OpenId_Consumer Basics
Zend_OpenId_Provider
Zend_Paginator
Introdução
Usage
Configuração
Advanced usage
Zend_Pdf
Introdução.
Criando e Carregando documentos PDF.
Salvar mudanças no documento PDF.
Document pages.
Drawing.
Interactive Features
Informação do Documento e Metadados.
Zend_Pdf module usage example
Zend_ProgressBar
Zend_ProgressBar
Zend_Queue
Introduction
Example usage
Framework
Adapters
Customizing Zend_Queue
Stomp
Zend_Reflection
Introduction
Zend_Reflection Examples
Zend_Reflection Reference
Zend_Registry
Using the Registry
Zend_Rest
Introduction
Zend_Rest_Client
Zend_Rest_Server
Zend_Search_Lucene
Resumo
Construindo Índices
Pesquisando em um Índice
Query Language
Tipos de Consulta
Conjuntos de Caracteres
Extensibilidade
Interoperando com Java Lucene
Advanced
Best Practices
Zend_Serializer
Introduction
Zend_Serializer_Adapter
Zend_Server
Introdução
Zend_Server_Reflection
Zend_Service
Introdução
Zend_Service_Akismet
Zend_Service_Amazon
Zend_Service_Amazon_Ec2
Zend_Service_Amazon_Ec2: Instances
Zend_Service_Amazon_Ec2: Windows Instances
Zend_Service_Amazon_Ec2: Reserved Instances
Zend_Service_Amazon_Ec2: CloudWatch Monitoring
Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)
Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)
Zend_Service_Amazon_Ec2: Elastic IP Addresses
Zend_Service_Amazon_Ec2: Keypairs
Zend_Service_Amazon_Ec2: Regions and Availability Zones
Zend_Service_Amazon_Ec2: Security Groups
Zend_Service_Amazon_S3
Zend_Service_Amazon_Sqs
Zend_Service_Audioscrobbler
Zend_Service_Delicious
Zend_Service_DeveloperGarden
Zend_Service_Flickr
Zend_Service_LiveDocx
Zend_Service_Nirvanix
Zend_Service_ReCaptcha
Zend_Service_Simpy
Zend_Service_SlideShare
Zend_Service_StrikeIron
Zend_Service_StrikeIron: Bundled Services
Zend_Service_StrikeIron: Advanced Uses
Zend_Service_Technorati
Zend_Service_Twitter
Zend_Service_WindowsAzure
Zend_Service_Yahoo
Zend_Session
Introduction
Basic Usage
Advanced Usage
Global Session Management
Zend_Session_SaveHandler_DbTable
Zend_Soap
Zend_Soap_Server
Zend_Soap_Client
WSDL Accessor
AutoDiscovery
Zend_Tag
Introduction
Zend_Tag_Cloud
Zend_Test
Introdução
Zend_Test_PHPUnit
Zend_Test_PHPUnit_Db
Zend_Text
Zend_Text_Figlet
Zend_Text_Table
Zend_TimeSync
Introduction
Working with Zend_TimeSync
Zend_Tool
Using Zend_Tool On The Command Line
Extending Zend_Tool
Zend_Tool_Framework
Introduction
Using the CLI Tool
Architecture
Creating Providers to use with Zend_Tool_Framework
Shipped System Providers
Extending and Configuring Zend_Tool_Framework
Zend_Tool_Project
Introduction
Create A Project
Zend_Tool Project Providers
Zend_Tool_Project Internals
Zend_Translate
Introduction
Adapters for Zend_Translate
Using Translation Adapters
Creating source files
Additional features for translation
Plural notations for Translation
Zend_Uri
Zend_Uri
Zend_Validate
Introduction
Standard Validation Classes
Validator Chains
Writing Validators
Validation Messages
Zend_Version
Obtendo a Versão do Zend Framework
Zend_View
Introdução
Scripts Controladores
Scripts de Visualização
Assistentes de Visualização (Modificadores)
Zend_View_Abstract
Zend_Wildfire
Zend_Wildfire
Zend_XmlRpc
Introduction
Zend_XmlRpc_Client
Zend_XmlRpc_Server
ZendX_Console_Process_Unix
ZendX_Console_Process_Unix
ZendX_JQuery
Introduction
ZendX_JQuery View Helpers
ZendX_JQuery Form Elements and Decorators
Pré-requisitos do Zend Framework
Introdução
Notas de Migração do Zend Framework
Zend Framework 1.10
Zend Framework 1.9
Zend Framework 1.8
Zend Framework 1.7
Zend Framework 1.6
Zend Framework 1.5
Zend Framework 1.0
Zend Framework 0.9
Zend Framework 0.8
Zend Framework 0.6
Padrões de Codificação do Framework Zend para PHP
Visão Geral
Formato do Arquivo PHP
Convenções de Nomes
Estilo de Código
Zend Framework Documentation Standard
Overview
Documentation File Formatting
Recommendations
Recommended Project Structure for Zend Framework MVC Applications
Overview
Recommended Project Directory Structure
Module Structure
Rewrite Configuration Guide
Guia de Desempenho do Zend Framework
Introdução
Class Loading
Zend_Db Performance
Internationalization (i18n) and Localization (l10n)
View Rendering
Informações Sobre Direitos Autorais