Skip to content

Commit 34aafcd

Browse files
committed
Final touches to second tutorial examples.
1 parent bcfad11 commit 34aafcd

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

php/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tutorials](http://www.rabbitmq.com/getstarted.html).
88

99
To run the examples you need a running RabbitMQ server.
1010

11-
Additionaly you need `PHP 5.3` and `php-amqplib`. To get this
11+
Additionaly you need `PHP 5.3` and `php-amqplib`. To get these
1212
dependencies on Ubuntu type:
1313

1414
sudo apt-get install git-core php5-cli

php/new_task.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php
22

33
require_once(__DIR__ . '/lib/php-amqplib/amqp.inc');
4-
include_once(__DIR__ . '/config/config.php');
54

6-
$connection = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
5+
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
76
$channel = $connection->channel();
87

9-
$channel->queue_declare('task_queue', false, true);
8+
9+
$channel->queue_declare('task_queue', false, true, false, false);
1010

1111
$data = implode(' ', array_slice($argv, 1));
1212
if(empty($data)) $data = "Hello World!";
13-
$msg = new AMQPMessage($data,
13+
$msg = new AMQPMessage($data,
1414
array('delivery_mode' => 2) # make message persistent
1515
);
1616

php/worker.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

33
require_once(__DIR__ . '/lib/php-amqplib/amqp.inc');
4-
include_once(__DIR__ . '/config/config.php');
54

6-
$connection = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
5+
$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
76
$channel = $connection->channel();
87

9-
$channel->queue_declare('task_queue', false, true);
8+
9+
$channel->queue_declare('task_queue', false, true, false, false);
1010

1111
echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";
1212

@@ -18,8 +18,8 @@
1818
};
1919

2020
$channel->basic_qos(null, 1, null);
21-
$channel->basic_consume('task_queue', 'consumer_tag', false, false, false, false, $callback);
22-
21+
$channel->basic_consume('task_queue', '', false, false, false, false, $callback);
22+
2323
while(count($channel->callbacks)) {
2424
$channel->wait();
2525
}

0 commit comments

Comments
 (0)