Created
March 7, 2016 21:06
-
-
Save prolic/c631b4750e70f1218c46 to your computer and use it in GitHub Desktop.
Rabbitmq publisher confirm test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$connection1 = new \AMQPConnection(); | |
$connection1->connect(); | |
$connection2 = new \AMQPConnection(); | |
$connection2->connect(); | |
$channel1 = new \AMQPChannel($connection1); | |
$channel2 = new \AMQPChannel($connection2); | |
$exchange = new \AMQPExchange($channel1); | |
$exchange->setName('test'); | |
$exchange->setType('direct'); | |
$exchange->declareExchange(); | |
$queue = new \AMQPQueue($channel2); | |
$queue->setName('test'); | |
$queue->declareQueue(); | |
$queue->bind('test'); | |
$channel1->confirmSelect(); | |
$exchange->publish('foo'); | |
$msg = $queue->get(); | |
var_dump($msg->getBody()); | |
$exchange->delete(); | |
$queue->delete(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment