Updated demo code to use AMQPStreamConnection class instead of the deprecated AMQPConnection class. It has been officially deprecated since Nov. 2014, see: videlalvaro/php-amqplib@64eb289#diff-d22541aa1646efa4a61d570b8a0a0ff0.
This commit is contained in:
parent
1300721ed7
commit
68241acf7a
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
$channel->exchange_declare('direct_logs', 'direct', false, false, false);
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
$channel->exchange_declare('direct_logs', 'direct', false, false, false);
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
$channel->exchange_declare('topic_logs', 'topic', false, false, false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
class FibonacciRpcClient {
|
||||
@ -12,7 +12,7 @@ class FibonacciRpcClient {
|
||||
private $corr_id;
|
||||
|
||||
public function __construct() {
|
||||
$this->connection = new AMQPConnection(
|
||||
$this->connection = new AMQPStreamConnection(
|
||||
'localhost', 5672, 'guest', 'guest');
|
||||
$this->channel = $this->connection->channel();
|
||||
list($this->callback_queue, ,) = $this->channel->queue_declare(
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
$channel->queue_declare('rpc_queue', false, false, false, false);
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||
|
||||
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
|
||||
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
|
||||
$channel = $connection->channel();
|
||||
|
||||
$channel->queue_declare('task_queue', false, true, false, false);
|
||||
|
Loading…
Reference in New Issue
Block a user