Skip to content

Commit fb805f0

Browse files
committed
Added keep-alive and heartbeat option to configuration
1 parent 7cc536b commit fb805f0

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

DependencyInjection/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ protected function addConnections(ArrayNodeDefinition $node)
5353
->scalarNode('password')->defaultValue('guest')->end()
5454
->scalarNode('vhost')->defaultValue('/')->end()
5555
->booleanNode('lazy')->defaultFalse()->end()
56+
->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+')->end()
57+
->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end()
5658
->end()
5759
->end()
5860
->end()

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ protected function loadConnections()
7979
$connection['port'],
8080
$connection['user'],
8181
$connection['password'],
82-
$connection['vhost']
82+
$connection['vhost'],
83+
false, // insist
84+
'AMQPLAIN', // login_method
85+
null, // login_response
86+
'en_US', // locale
87+
3, // connection_timeout
88+
3, // read_write_timeout
89+
null, // context
90+
$connection['keepalive'],
91+
$connection['heartbeat'],
8392
));
8493

8594
$this->container->setDefinition(sprintf('old_sound_rabbit_mq.connection.%s', $key), $definition);

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,18 @@ Add the `old_sound_rabbit_mq` section in your configuration file:
115115
old_sound_rabbit_mq:
116116
connections:
117117
default:
118-
host: 'localhost'
119-
port: 5672
120-
user: 'guest'
121-
password: 'guest'
122-
vhost: '/'
123-
lazy: false
118+
host: 'localhost'
119+
port: 5672
120+
user: 'guest'
121+
password: 'guest'
122+
vhost: '/'
123+
lazy: false
124+
125+
# requires php-amqplib v2.4.1+
126+
keepalive: false
127+
128+
# requires php-amqplib v2.4.1+
129+
heartbeat: 0
124130
producers:
125131
upload_picture:
126132
connection: default

0 commit comments

Comments
 (0)