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



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

SAMConnection->send()

Send a message to a queue or publish an item to a topic. ()

Example 2127. Send a message to a queue

<?php
$msg
= new SAMMessage('This is a simple text message');
$correlId = $conn->send('queue://send/test', $msg);
if (!
$correlId) {
   
// The send failed!
   
echo "Send failed ($conn->errno) $conn->error";
}

?>

Example 2128. Publish a message to a topic

<?php
$msg
= new SAMMessage('This is a simple text item');
if (!
$conn->send('topic://test', $msg)) {
   
// The Send failed!
   
echo "Send failed ($conn->errno) $conn->error";
}
?>

Example 2129. Send a request and receive a response

<?php
$msg
= new SAMMessage('This is a simple text message');
$msg->header->SAM_REPLY_TO = 'queue://receive/test';
$correlid = $conn->send('queue://send/test', $msg);

if (!
$correlid) {
   
// The Send failed!
   
echo "Send failed ($conn->errno) $conn->error";
} else {
   
$resp = $conn->receive('queue://receive/test', array(SAM_CORRELID => $correlid));
}
?>

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