Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : SAM - Simple Asynchronous Messaging : SAMConnection->receive()

SAMConnection->receive()

Receive a message from a queue or subscription. ()

Example 2122. Receiving a message from a queue

<?php
$msg
= $conn->receive('queue://receive/test');

if (!
$msg) {
 
// The receive failed!
 
echo "Receive failed ($conn->errno) $conn->error";
}
?>

Example 2123. Receiving a message from a queue with options

In this example the SAM_CORRELID option is used to specify a correlation id string to be used to identify the message to receive. A wait timeout of 10 seconds is also specified.

<?php

$msg
= $conn->receive('queue://receive/test', array(SAM_CORRELID => $token, SAM_WAIT => 10000));

?>

Example 2124. Receiving a message from a subscription

In this example we show how to receive a message from a subscription id.

<?php
$msg
= $conn->receive($subscriptionName);

if (!
$msg) {
 
// The receive failed!
 
echo "Receive failed ($conn->errno) $conn->error";
}
?>

Please note that $subscriptionName is a subscription id returned from an earlier subscribe call.


Change Language


Follow Navioo On Twitter
SAMConnection->commit()
SAMConnection->connect()
SAMConnection->__construct()
SAMConnection->disconnect()
SAMConnection->errno
SAMConnection->error
SAMConnection->isConnected()
SAMConnection->peek()
SAMConnection->peekAll()
SAMConnection->receive()
SAMConnection->remove()
SAMConnection->rollback()
SAMConnection->send()
SAMConnection::setDebug()
SAMConnection->subscribe()
SAMConnection->unsubscribe()
SAMMessage->body
SAMMessage->__construct()
SAMMessage->header
eXTReMe Tracker