Created
March 8, 2012 21:54
-
-
Save johndemic/2003703 to your computer and use it in GitHub Desktop.
Order Update Consumption with AMQP and 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 events-exchange | |
$ex = new AMQPExchange($ch); | |
$ex->setName("events-exchange"); | |
$ex->setType(AMQP_EX_TYPE_TOPIC); | |
$ex->setFlags(AMQP_DURABLE); | |
$ex->declare(); | |
$q = new AMQPQueue($ch); | |
$q->setName('order-event-consumer'); | |
$q->declare(); | |
$q->bind('events-exchange', 'order.*'); | |
function processOrderEvent($envelope, $queue) { | |
// do stuff | |
} | |
$q->consume("processOrderEvent"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment