Skip to content

Commit 68241ac

Browse files
Updated demo code to use AMQPStreamConnection class instead of the deprecated AMQPConnection class. It has been officially deprecated since Nov. 2014, see: php-amqplib/php-amqplib@64eb289#diff-d22541aa1646efa4a61d570b8a0a0ff0.
1 parent 1300721 commit 68241ac

12 files changed

+24
-24
lines changed

php/emit_log.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010

php/emit_log_direct.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010
$channel->exchange_declare('direct_logs', 'direct', false, false, false);

php/emit_log_topic.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010

php/new_task.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010

php/receive.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55

6-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
6+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
77
$channel = $connection->channel();
88

99

php/receive_logs.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55

6-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
6+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
77
$channel = $connection->channel();
88

99

php/receive_logs_direct.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55

6-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
6+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
77
$channel = $connection->channel();
88

99
$channel->exchange_declare('direct_logs', 'direct', false, false, false);

php/receive_logs_topic.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55

6-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
6+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
77
$channel = $connection->channel();
88

99
$channel->exchange_declare('topic_logs', 'topic', false, false, false);

php/rpc_client.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

77
class FibonacciRpcClient {
@@ -12,7 +12,7 @@ class FibonacciRpcClient {
1212
private $corr_id;
1313

1414
public function __construct() {
15-
$this->connection = new AMQPConnection(
15+
$this->connection = new AMQPStreamConnection(
1616
'localhost', 5672, 'guest', 'guest');
1717
$this->channel = $this->connection->channel();
1818
list($this->callback_queue, ,) = $this->channel->queue_declare(

php/rpc_server.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010
$channel->queue_declare('rpc_queue', false, false, false, false);

php/send.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55
use PhpAmqpLib\Message\AMQPMessage;
66

7-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
7+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
88
$channel = $connection->channel();
99

1010

php/worker.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
require_once __DIR__ . '/vendor/autoload.php';
4-
use PhpAmqpLib\Connection\AMQPConnection;
4+
use PhpAmqpLib\Connection\AMQPStreamConnection;
55

6-
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
6+
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
77
$channel = $connection->channel();
88

99
$channel->queue_declare('task_queue', false, true, false, false);

0 commit comments

Comments
 (0)