forked from rabbitinaction/sourcecode
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aae9885
commit 90b8f3b
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
require_once('./php-amqplib/amqp.inc'); | ||
|
||
define('HOST', 'localhost'); | ||
define('PORT', 5672); | ||
define('USER', 'guest'); | ||
define('PASS', 'guest'); | ||
|
||
#/(rex.1) Obtain a connection and a channel | ||
$conn = new AMQPConnection(HOST, PORT, USER, PASS); | ||
$channel = $conn->channel(); | ||
|
||
#/(rex.2) Declare the exchnage | ||
$channel->exchange_declare('logs-exchange', | ||
'topic', false, true, false); | ||
|
||
#/(rex.3) Declare the queues | ||
$channel->queue_declare('msg-inbox-errors', | ||
false, true, false, false); | ||
|
||
$channel->queue_declare('msg-inbox-logs', | ||
false, true, false, false); | ||
|
||
$channel->queue_declare('all-logs', false, | ||
true, false, false); | ||
|
||
#/(rex.4) Bind the queues to the exchange | ||
$channel->queue_bind('msg-inbox-errors', | ||
'logs-exchange', 'error.msg-inbox'); | ||
|
||
$channel->queue_bind('msg-inbox-logs', | ||
'logs-exchange', '*.msg-inbox'); | ||
?> |