「php開発」phpでメッセージキューの使い方

1.サーバー側
$exchannel = \Tang\Amqp\AmqpService::getService()->get()->getExchannel('demo_startnews24’);
$exchannel->publish('message’);
//messageを発送

2.クライアント側
$exchannel = \Tang\Amqp\AmqpService::getService()->get()->getExchannel('demo_startnews24’);
$queue = $exchannel->getQueue('node1’);//node1キューを取得
$queue->consume(function(\Tang\Amqp\Message $message)
{
$body = $message->body();
echo $body;//輸出
},true);

PHP

Posted by arkgame