PhpRiot
Follow phpriot on Twitter
Sponsored Link
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
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

AMQPQueue::get

(PECL amqp >= Unknown)

AMQPQueue::getRetrieve the next message from the queue.

Description

public array AMQPQueue::get ([ int $flags = AMQP_NOACK ] )

Retrieve the next message from the queue. This is a non-blocking operation, which means that if there is no message on the queue, the function will return immediately with no message.

Parameters

flags

A bitmask of any of the flags: AMQP_NOACK.

Return Values

Returns array possibly containing keys routing_key, exchange, delivery_tag, Content-type, Content-encoding, type, timestamp, priority, expiration, user_id, app_id, message_id, Reply-to, count, msg.

Examples

Example #1 AMQPQueue::get example

<?php

/* Create a connection using all default credentials: */
$connection = new AMQPConnection();
$connection->connect();

/* create a queue object */
$queue = new AMQPQueue($connection);

//declare the queue
$queue->declare('myqueue');

//get the next message
$message $queue->get();

echo 
$message['msg'];

?>

PHP Manual