Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Last active February 17, 2016 13:48
Show Gist options
  • Save ebuildy/51f48bab0b01ed914f64 to your computer and use it in GitHub Desktop.
Save ebuildy/51f48bab0b01ed914f64 to your computer and use it in GitHub Desktop.
Php AMQP
$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