-rabbitmq test files
This commit is contained in:
parent
cf7f278e19
commit
875c758790
2 changed files with 7 additions and 5 deletions
|
@ -14,7 +14,7 @@ $PORT = 5672;
|
|||
$USER = 'guest';
|
||||
$PASS = 'guest';
|
||||
$VHOST = '/';
|
||||
$EXCHANGE = 'router';
|
||||
$EXCHANGE = 'airtime-schedule';
|
||||
$QUEUE = 'msgs';
|
||||
$CONSUMER_TAG = 'consumer';
|
||||
|
||||
|
@ -23,7 +23,7 @@ $ch = $conn->channel();
|
|||
$ch->access_request($VHOST, false, false, true, true);
|
||||
|
||||
$ch->queue_declare($QUEUE);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
$ch->queue_bind($QUEUE, $EXCHANGE);
|
||||
|
||||
function process_message($msg) {
|
||||
|
|
|
@ -13,15 +13,16 @@ $PORT = 5672;
|
|||
$USER = 'guest';
|
||||
$PASS = 'guest';
|
||||
$VHOST = '/';
|
||||
$EXCHANGE = 'router';
|
||||
$EXCHANGE = 'airtime-schedule';
|
||||
$QUEUE = 'msgs';
|
||||
|
||||
$conn = new AMQPConnection($HOST, $PORT, $USER, $PASS);
|
||||
$ch = $conn->channel();
|
||||
$ch->access_request($VHOST, false, false, true, true);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
|
||||
$msg_body = implode(' ', array_slice($argv, 1));
|
||||
$msg_body = json_encode(array("event_type"=>"get_status", "id"=>time()));
|
||||
//$msg_body = '{"schedule":{"status":{"range":{"start":"2011-09-12 20:45:22","end":"2011-09-13 20:45:22"},"version":"1.1"},"playlists":[],"check":1,"stream_metadata":{"format":"","station_name":""}},"event_type":"update_schedule"}';
|
||||
$msg = new AMQPMessage($msg_body, array('content_type' => 'text/plain'));
|
||||
|
||||
$ch->basic_publish($msg, $EXCHANGE);
|
||||
|
@ -29,4 +30,5 @@ $ch->basic_publish($msg, $EXCHANGE);
|
|||
echo "Sent message '".$msg_body."'\n";
|
||||
$ch->close();
|
||||
$conn->close();
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue