To receive one or more messages from the queue, use the
receiveMessages() method. This method returns a
Zend_Cloud_QueueService_MessageSet instance by default, unless
configured otherwise. Each element of the MessageSet is an instance of
Zend_Cloud_QueueService_Message by default, unless configuired
otherwise.
Example 92. Receiving a message
<?php
// Get the first message
$messages = $queues->receiveMessages($queueId);
if (count($messages)) {
foreach ($messages as $message) {
echo "Message: " . $message->getBody();
break;
}
}
// Get two messages
$messages = $queues->receiveMessages($queueId, 2);
When a message is received, it is not visible to other clients. It is not deleted from
the queue, however, until the client that has received the message calls the
deleteMessage() method. If it is not deleted during the
specfied visibility timeout, it will become visible to all other clients again. In other
words, all clients will be able to retrieve the message with the
receiveMessages() method if the visibility timeout is exceeded.




