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


The Zend_Queue is a proxy that hides the details of the queue services. The queue services are represented by Zend_Queue_Adapter_<service>. For example, Zend_Queue_Adapter_Db is a queue that will use database tables to store and retrieve messages.

Below is an example for using database tables for a queuing system:

= array(
'name'          => 'queue1',
'driverOptions' => array(
'host'      => '',
'port'      => '3306',
'username'  => 'queue',
'password'  => 'queue',
'dbname'    => 'queue',
'type'      => 'pdo_mysql'

// Create a database queue.
// Zend_Queue will prepend Zend_Queue_Adapter_ to 'Db' for the class name.
$queue = new Zend_Queue('Db'$options);

The Zend_Queue constructor will create a Zend_Queue_Adapter_Db and initialize the adapter with the configuration settings.

The accepted configuration settings for each adapter are provided in the adapter notes.

Zend_Queue returns messages using the class Zend_Queue_Message_Iterator, which is an implementation of SPL Iterator and Countable. Zend_Queue_Message_Iterator contains an array of Zend_Queue_Message objects.

foreach (
$messages as $i => $message) {
"$i) Message => "$message->body"\n";

Any exceptions thrown are of class Zend_Queue_Exception.

Zend Framework