Created
January 19, 2011 19:45
-
-
Save anonymous/786716 to your computer and use it in GitHub Desktop.
A demo of how to use amqphp
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 | |
require 'amqp.php'; | |
use amqp_091 as amqp; | |
use amqp_091\protocol; | |
use amqp_091\wire; | |
$params = array('username' => 'testing', | |
'userpass' => 'letmein', | |
'vhost' => 'robin', | |
'exchange' => 'unit-test-basic', | |
'socketImpl' => '\amqp_091\Socket', | |
'socketParams' => array( | |
'host' => 'localhost', | |
'port' => '5672')); | |
$c = new amqp\Connection($params); | |
$c->connect(); | |
$chan = $c->getChannel(); | |
$msg = $chan->basic('publish', array('content-type' => 'text/plain', | |
'content-encoding' => 'UTF-8', | |
'routing-key' => '', | |
'mandatory' => false, | |
'immediate' => false, | |
'exchange' => 'unit-test-basic'), 'This is the message content'); | |
$chan->invoke($msg); | |
echo "Done!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment