removed author tags
This commit is contained in:
parent
4f75c1084d
commit
b4b3830eb3
0
php-amqp/README.md
Normal file
0
php-amqp/README.md
Normal file
@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
emit_log.php
|
||||
@author Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
emit_log_direct.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
emit_log_topic.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,8 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
@author Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
@author Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
//Establish connection AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
receive_log_topic.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
receive_logs.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
receive_logs_direct.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
//Establish Connection
|
||||
$connection = new AMQPConnection();
|
||||
|
54
php-amqp/receive_logs_topic.php
Normal file
54
php-amqp/receive_logs_topic.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
|
||||
//Establish Connection
|
||||
$connection = new AMQPConnection();
|
||||
$connection->setHost('127.0.0.1');
|
||||
$connection->setLogin('guest');
|
||||
$connection->setPassword('guest');
|
||||
$connection->connect();
|
||||
|
||||
|
||||
//Listen on Channel
|
||||
$channel = new AMQPChannel($connection);
|
||||
|
||||
|
||||
$binding_keys = array_slice($argv,1);
|
||||
if(empty($binding_keys)) {
|
||||
file_put_contents('php://stderr', "Usage: {$argv[0]} [binding_key]...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo " [*] Waiting for logs. To exit press CTRL+C", PHP_EOL;
|
||||
$callback_func = function(AMQPEnvelope $message, AMQPQueue $q) {
|
||||
echo sprintf(" [X] [%s] %s",$message->getRoutingKey(),$message->getBody()), PHP_EOL;
|
||||
$q->nack($message->getDeliveryTag());
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
try {
|
||||
//Declare Exchange
|
||||
$exchange_name = 'topic_logs';
|
||||
$exchange = new AMQPExchange($channel);
|
||||
$exchange->setType(AMQP_EX_TYPE_TOPIC);
|
||||
$exchange->setName($exchange_name);
|
||||
$exchange->declareExchange();
|
||||
|
||||
|
||||
|
||||
//Declare Queue
|
||||
$queue = new AMQPQueue($channel);
|
||||
$queue->setFlags(AMQP_EXCLUSIVE);
|
||||
$queue->declareQueue();
|
||||
foreach($binding_keys as $binding_key) {
|
||||
$queue->bind($exchange_name, $binding_key);
|
||||
}
|
||||
|
||||
$queue->consume($callback_func);
|
||||
} catch(AMQPQueueException $ex) {
|
||||
print_r($ex);
|
||||
} catch(Exception $ex) {
|
||||
print_r($ex);
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
rpc_client.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
class FibonacciRpcClient {
|
||||
private $connection;
|
||||
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
rpc_server.php
|
||||
@author: Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
function fib($n) {
|
||||
if($n == 0)
|
||||
|
@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
@author Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
//Establish connection to AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
@author Chimdi Azubuike <me@chimdi.com>
|
||||
*/
|
||||
|
||||
|
||||
//Establish connection AMQP
|
||||
$connection = new AMQPConnection();
|
||||
|
Loading…
Reference in New Issue
Block a user