downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

配信/購読およびトピックの購読> <メッセージ
[edit] Last updated: Fri, 10 Feb 2012

view this page in

メッセージング操作

すべてのメッセージング操作は、接続オブジェクトのメソッドをコールすることで行います。 キューにメッセージを追加するには "send" メソッドを使用し、 キューからメッセージを取得するには "receive" メソッドを使用します。 その他のメソッドには、配信や購読機能、 そしてトランザクションの境界の制御などがあります。

例1 キューへのメッセージの追加および応答の取得

<?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) {
  
// 送信に失敗しました!
  
echo "Send failed ($conn->errno$conn->error";
} else {
  
$resp $conn->receive('queue://receive/test', array(SAM_CORRELID => $correlid));
}
?>



add a note add a note User Contributed Notes メッセージング操作
a dot hoyau at silexlabs dot org 24-Aug-2011 01:27
Hello

I think that most people people coming here are looking to do this on client side, in client/server web applications

Sam is not made for this, but to connect servers together - systems in fact. See http://project-sam.awardspace.com/overview.htm

Since PHP is stateless it is really hard to do collaborative applications with a PHP back-end and very few solutions exist. So, for those looking for this, I put here a link to a messaging server in PHP - free open source and community driven: http://php-polling.sourceforge.net/

Hoping this will make you save time!

 
show source | credits | stats | sitemap | contact | advertising | mirror sites