From f52bce4b8d40a2762f955277890d13068b2ef2b9 Mon Sep 17 00:00:00 2001 From: Bravo Man Date: Tue, 15 Nov 2022 13:26:41 +0100 Subject: [PATCH 1/5] Added channel_rpc_timeout as possible option --- RabbitMq/AMQPConnectionFactory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/RabbitMq/AMQPConnectionFactory.php b/RabbitMq/AMQPConnectionFactory.php index 463856bd..27e8f806 100644 --- a/RabbitMq/AMQPConnectionFactory.php +++ b/RabbitMq/AMQPConnectionFactory.php @@ -26,6 +26,7 @@ class AMQPConnectionFactory 'keepalive' => false, 'heartbeat' => 0, 'hosts' => [], + 'channel_rpc_timeout' => 0 ]; /** From 9cc13e2fe2d9816771380dc63759dbc5d567490d Mon Sep 17 00:00:00 2001 From: Bravo Man Date: Thu, 1 Dec 2022 17:45:14 +0100 Subject: [PATCH 2/5] This should fix the failing tests. --- Tests/RabbitMq/AMQPConnectionFactoryTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/RabbitMq/AMQPConnectionFactoryTest.php b/Tests/RabbitMq/AMQPConnectionFactoryTest.php index f7a2f6d6..e3dc5aa8 100644 --- a/Tests/RabbitMq/AMQPConnectionFactoryTest.php +++ b/Tests/RabbitMq/AMQPConnectionFactoryTest.php @@ -277,6 +277,7 @@ public function testSSLConnectionParameters() 'context' => null, // context checked earlier 'keepalive' => false, 'heartbeat' => 0, + 'channel_rpc_timeout' => 0, ], ], $instance->constructParams); } @@ -351,6 +352,7 @@ public function testClusterConnectionParametersWithoutRootConnectionKeys() 'ssl_context' => null, 'keepalive' => false, 'heartbeat' => 0, + 'channel_rpc_timeout' => 0, ], ], $instance::$createConnectionParams @@ -422,6 +424,7 @@ public function testClusterConnectionParametersWithRootConnectionKeys() 'ssl_context' => null, 'keepalive' => false, 'heartbeat' => 0, + 'channel_rpc_timeout' => 0, ], ], $instance::$createConnectionParams @@ -500,6 +503,7 @@ public function testSSLClusterConnectionParameters() 'context' => null, 'keepalive' => false, 'heartbeat' => 0, + 'channel_rpc_timeout' => 0, ], ], $instance->constructParams); @@ -534,6 +538,7 @@ public function testSSLClusterConnectionParameters() 'context' => null, // context checked earlier 'keepalive' => false, 'heartbeat' => 0, + 'channel_rpc_timeout' => 0, ], ], $instance::$createConnectionParams @@ -611,6 +616,7 @@ public function testSocketClusterConnectionParameters() 'read_write_timeout' => 3, 'read_timeout' => 3, 'write_timeout' => 3, + 'channel_rpc_timeout' => 0, ], ], $instance::$createConnectionParams From 6aebd4f8c3b40bffa7d8e9e85f6bc1f9dfa25df8 Mon Sep 17 00:00:00 2001 From: Bravo Man Date: Fri, 21 Apr 2023 17:52:26 +0200 Subject: [PATCH 3/5] Added default value for channel_rpc_timeout in config treebuilder --- DependencyInjection/Configuration.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 844d5665..9f6450fb 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -92,6 +92,7 @@ protected function addConnections(ArrayNodeDefinition $node) ->booleanNode('lazy')->defaultFalse()->end() ->scalarNode('connection_timeout')->defaultValue(3)->end() ->scalarNode('read_write_timeout')->defaultValue(3)->end() + ->scalarNode('channel_rpc_timeout')->defaultValue(0)->end() ->booleanNode('use_socket')->defaultValue(false)->end() ->arrayNode('ssl_context') ->useAttributeAsKey('key') @@ -101,6 +102,7 @@ protected function addConnections(ArrayNodeDefinition $node) ->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+ and PHP5.4+')->end() ->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end() ->scalarNode('connection_parameters_provider')->end() + ->end() ->end() ->end() From 215140fc1a90d740985c285f703e29f52abd1c35 Mon Sep 17 00:00:00 2001 From: Bravo Man Date: Fri, 21 Apr 2023 17:56:20 +0200 Subject: [PATCH 4/5] Update README with channel_rpc_timeout --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ce0b8c18..b6e344c8 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,9 @@ old_sound_rabbit_mq: lazy: false connection_timeout: 3 read_write_timeout: 3 + + # the timeout when waiting for a response from rabbitMQ (0 means waits forever) + channel_rpc_timeout: 0 # requires php-amqplib v2.4.1+ and PHP5.4+ keepalive: false From 0317aec8cd8b11ce45413899fb2574a1a25050d4 Mon Sep 17 00:00:00 2001 From: Bravo Man Date: Fri, 28 Apr 2023 10:35:34 +0200 Subject: [PATCH 5/5] Apply suggestions from code review --- DependencyInjection/Configuration.php | 3 +-- README.md | 4 ++-- RabbitMq/AMQPConnectionFactory.php | 2 +- Tests/RabbitMq/AMQPConnectionFactoryTest.php | 12 ++++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 9f6450fb..503ecd9e 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -92,7 +92,7 @@ protected function addConnections(ArrayNodeDefinition $node) ->booleanNode('lazy')->defaultFalse()->end() ->scalarNode('connection_timeout')->defaultValue(3)->end() ->scalarNode('read_write_timeout')->defaultValue(3)->end() - ->scalarNode('channel_rpc_timeout')->defaultValue(0)->end() + ->scalarNode('channel_rpc_timeout')->defaultValue(0.0)->end() ->booleanNode('use_socket')->defaultValue(false)->end() ->arrayNode('ssl_context') ->useAttributeAsKey('key') @@ -102,7 +102,6 @@ protected function addConnections(ArrayNodeDefinition $node) ->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+ and PHP5.4+')->end() ->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end() ->scalarNode('connection_parameters_provider')->end() - ->end() ->end() ->end() diff --git a/README.md b/README.md index b6e344c8..18ec3e0b 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,8 @@ old_sound_rabbit_mq: connection_timeout: 3 read_write_timeout: 3 - # the timeout when waiting for a response from rabbitMQ (0 means waits forever) - channel_rpc_timeout: 0 + # the timeout when waiting for a response from rabbitMQ (0.0 means waits forever) + channel_rpc_timeout: 0.0 # requires php-amqplib v2.4.1+ and PHP5.4+ keepalive: false diff --git a/RabbitMq/AMQPConnectionFactory.php b/RabbitMq/AMQPConnectionFactory.php index 27e8f806..59db599e 100644 --- a/RabbitMq/AMQPConnectionFactory.php +++ b/RabbitMq/AMQPConnectionFactory.php @@ -26,7 +26,7 @@ class AMQPConnectionFactory 'keepalive' => false, 'heartbeat' => 0, 'hosts' => [], - 'channel_rpc_timeout' => 0 + 'channel_rpc_timeout' => 0.0 ]; /** diff --git a/Tests/RabbitMq/AMQPConnectionFactoryTest.php b/Tests/RabbitMq/AMQPConnectionFactoryTest.php index e3dc5aa8..deb93082 100644 --- a/Tests/RabbitMq/AMQPConnectionFactoryTest.php +++ b/Tests/RabbitMq/AMQPConnectionFactoryTest.php @@ -277,7 +277,7 @@ public function testSSLConnectionParameters() 'context' => null, // context checked earlier 'keepalive' => false, 'heartbeat' => 0, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance->constructParams); } @@ -352,7 +352,7 @@ public function testClusterConnectionParametersWithoutRootConnectionKeys() 'ssl_context' => null, 'keepalive' => false, 'heartbeat' => 0, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance::$createConnectionParams @@ -424,7 +424,7 @@ public function testClusterConnectionParametersWithRootConnectionKeys() 'ssl_context' => null, 'keepalive' => false, 'heartbeat' => 0, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance::$createConnectionParams @@ -503,7 +503,7 @@ public function testSSLClusterConnectionParameters() 'context' => null, 'keepalive' => false, 'heartbeat' => 0, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance->constructParams); @@ -538,7 +538,7 @@ public function testSSLClusterConnectionParameters() 'context' => null, // context checked earlier 'keepalive' => false, 'heartbeat' => 0, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance::$createConnectionParams @@ -616,7 +616,7 @@ public function testSocketClusterConnectionParameters() 'read_write_timeout' => 3, 'read_timeout' => 3, 'write_timeout' => 3, - 'channel_rpc_timeout' => 0, + 'channel_rpc_timeout' => 0.0, ], ], $instance::$createConnectionParams