Programmer's Reference Guide
Example usage
The below example of Zend_Queue shows a variety of
features, including queue creation, queue retrieval, message retrieval,
message deletion, and sending messages.
// For configuration options
// @see Zend_Queue_Adapater::__construct()
'name' => 'queue1' ,
) ;
// Create an array queue
$queue = new Zend_Queue( 'Array' , $options ) ;
// Get list of queues
foreach ( $queue ->getQueues ( ) as $name ) {
}
// Create a new queue
$queue2 = $queue ->createQueue ( 'queue2' ) ;
// Get number of messages in a queue (supports Countable interface from SPL)
// Get up to 5 messages from a queue
$messages = $queue ->receive ( 5 ) ;
foreach ( $messages as $i => $message ) {
echo $message ->
body ,
"\n " ;
// We have processed the message; now we remove it from the queue.
$queue ->deleteMessage ( $message ) ;
}
// Send a message to the currently active queue
$queue ->send ( 'My Test Message' ) ;
// Delete a queue we created and all of it's messages
$queue ->deleteQueue ( 'queue2' ) ;
Please enable JavaScript to view the comments powered by Disqus.
blog comments powered by
Select a Version
1.11
1.10
1.9
1.8
1.7
1.6
1.5
1.0
Languages Available
Deutsch English Français 日本語 Русский 简体中文
Components
Select a component
Zend_Acl
Zend_Amf
Zend_Application
Zend_Auth
Zend_Barcode
Zend_Cache
Zend_Captcha
SimpleCloud API: Zend_Cloud
Zend_CodeGenerator
Zend_Config
Zend_Config_Writer
Zend_Console_Getopt
Zend_Controller
Zend_Currency
Zend_Date
Zend_Db
Zend_Debug
Zend_Dojo
Zend_Dom
Zend_Exception
Zend_Feed
Zend_File
Zend_Filter
Zend_Form
Zend_Gdata
Zend_Http
Zend_InfoCard
Zend_Json
Zend_Layout
Zend_Ldap
Zend_Loader
Zend_Locale
Zend_Log
Zend_Mail
Zend_Markup
Zend_Measure
Zend_Memory
Zend_Mime
Zend_Navigation
Zend_Oauth
Zend_OpenId
Zend_Paginator
Zend_Pdf
Zend_ProgressBar
Zend_Queue
Zend_Reflection
Zend_Registry
Zend_Rest
Zend_Search_Lucene
Zend_Serializer
Zend_Server
Zend_Service
Zend_Session
Zend_Soap
Zend_Tag
Zend_Test
Zend_Text
Zend_TimeSync
Zend_Tool
Zend_Tool_Framework
Zend_Tool_Project
Zend_Translate
Zend_Uri
Zend_Validate
Zend_Version
Zend_View
Zend_Wildfire
Zend_XmlRpc
ZendX_Console_Process_Unix
ZendX_JQuery