Last active
February 17, 2016 13:48
-
-
Save ebuildy/51f48bab0b01ed914f64 to your computer and use it in GitHub Desktop.
Php AMQP
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
$connection = new AMQPConnection([ | |
'host' => 'queue', | |
'port' => 5672, | |
'login' => 'guest', | |
'password' => 'guest' | |
]); | |
$connection->connect(); | |
$channel = new AMQPChannel($connection); | |
$queue = new AMQPQueue($channel); | |
$queue->setName('test-ampq-extension'); | |
$queue->declareQueue(); | |
$exchange = new AMQPExchange($channel); | |
$exchange->setName("exchange-hello-world"); | |
$exchange->setType(AMQP_EX_TYPE_FANOUT); | |
$exchange->declareExchange(); | |
$queue->bind($exchange->getName()); | |
$exchange->publish('Hello you!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment