Created
March 8, 2012 21:42
-
-
Save johndemic/2003654 to your computer and use it in GitHub Desktop.
Submitting an Order to an AMQP Exchange with PHP
This file contains hidden or 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
$cnn = new AMQPConnection(); | |
$cnn->connect(); | |
// Create a channel | |
$ch = new AMQPChannel($cnn); | |
// Declare the orders-exchange | |
$ex = new AMQPExchange($ch); | |
$ex->setName("orders-exchange"); | |
$ex->setType(AMQP_EX_TYPE_DIRECT); | |
$ex->setFlags(AMQP_DURABLE); | |
$ex->declare(); | |
// Publish a message to the exchange with the "order.submit" routing key | |
$msg = $ex->publish($orderJson, "order.submit", AMQP_NOPARAM, | |
array("Content-type" => "text/json")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment