Skip to content

Instantly share code, notes, and snippets.

@johndemic
Created March 8, 2012 21:42
Show Gist options
  • Save johndemic/2003654 to your computer and use it in GitHub Desktop.
Save johndemic/2003654 to your computer and use it in GitHub Desktop.
Submitting an Order to an AMQP Exchange with PHP
$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