Skip to content

Commit c39b447

Browse files
committed
add changelog, add readme, fix small issue in tests
1 parent 1741a3a commit c39b447

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- 2021-05-15
2+
* Add possibility to use multiple RabbitMQ hosts
3+
14
- 2017-01-22
25
* Add `graceful_max_execution_timeout`
36

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,37 @@ It's a good idea to set the ```read_write_timeout``` to 2x the heartbeat so your
195195
Please bear in mind, that you can expect problems, if your tasks are generally running longer than the heartbeat period, to which there are no good solutions ([link](https://github.com/php-amqplib/RabbitMqBundle/issues/301)).
196196
Consider using either a big value for the heartbeat or leave the heartbeat disabled in favour of the tcp's `keepalive` (both on the client and server side) and the `graceful_max_execution_timeout` feature.
197197

198+
### Multiple Connections ###
199+
200+
You can provide multiple hosts for a connection. This will allow you to use RabbitMQ cluster with multiple nodes.
201+
202+
```yaml
203+
old_sound_rabbit_mq:
204+
connections:
205+
default:
206+
hosts:
207+
- host: host1
208+
port: 3672
209+
user: user1
210+
password: password1
211+
vhost: vhost1
212+
- url: 'amqp://guest:password@localhost:5672/vhost'
213+
connection_timeout: 3
214+
read_write_timeout: 3
215+
```
216+
217+
Pay attention that you can not specify
218+
```yaml
219+
connection_timeout
220+
read_write_timeout
221+
use_socket
222+
ssl_context
223+
keepalive
224+
heartbeat
225+
connection_parameters_provider
226+
```
227+
parameters to each host separately.
228+
198229
### Dynamic Connection Parameters ###
199230

200231
Sometimes your connection information may need to be dynamic. Dynamic connection parameters allow you to supply or

Tests/RabbitMq/RpcClientTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace OldSound\RabbitMqBundle\Tests\RabbitMq;
44

5+
use InvalidArgumentException;
56
use OldSound\RabbitMqBundle\RabbitMq\RpcClient;
67
use PhpAmqpLib\Exception\AMQPTimeoutException;
78
use PhpAmqpLib\Message\AMQPMessage;
@@ -64,7 +65,7 @@ public function testInvalidParameterOnNotify()
6465
->disableOriginalConstructor()
6566
->getMock();
6667

67-
$this->expectException('\InvalidArgumentException');
68+
$this->expectException(InvalidArgumentException::class);
6869

6970
$client->notify('not a callable');
7071
}
@@ -84,7 +85,7 @@ public function testChannelCancelOnGetRepliesException()
8485
->method('wait')
8586
->willThrowException(new AMQPTimeoutException());
8687

87-
$this->expectException('\PhpAmqpLib\Exception\AMQPTimeoutException');
88+
$this->expectException(AMQPTimeoutException::class);
8889

8990
$channel->expects($this->once())
9091
->method('basic_cancel');

0 commit comments

Comments
 (0)