Introduction

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.

  1. // For configuration options
  2. // @see Zend_Queue_Adapater::__construct()
  3. 'name' => 'queue1',
  4. );
  5.  
  6. // Create an array queue
  7. 'Array', $options);
  8.  
  9. // Get list of queues
  10. "\n";
  11. }
  12.  
  13. // Create a new queue
  14. $queue2 = $queue->createQueue('queue2');
  15.  
  16. // Get number of messages in a queue (supports Countable interface from SPL)
  17. // Get up to 5 messages from a queue
  18. "\n";
  19.  
  20.     // We have processed the message; now we remove it from the queue.
  21.     $queue->deleteMessage($message);
  22. }
  23.  
  24. // Send a message to the currently active queue
  25. 'My Test Message');
  26.  
  27. // Delete a queue we created and all of it's messages
  28. $queue->deleteQueue('queue2');

Introduction