From a4b4637fc3659857b6c2c8bd6c94179428a8f113 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Wed, 21 Aug 2019 14:21:01 +0800 Subject: [PATCH] Introduce the new rabbit_heartbeat_in_pthread option oslo.messaging RabbitMQ driver have now a new option that allow user to run the RabbitMQ heartbeat over a native python thread. These change allow user to use this new option. Change-Id: Ie38832955897dee71ec60276fe30474ce9f4b2bf Closes-Bug: #1840868 --- manifests/init.pp | 12 ++++++++++++ ...itmq-heartbeat-over-pthread-a0355cfcb8ff0dfe.yaml | 6 ++++++ spec/classes/congress_init_spec.rb | 4 +++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/rabbitmq-heartbeat-over-pthread-a0355cfcb8ff0dfe.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 6f8d5a4..feff0c6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -49,6 +49,16 @@ # every 30 seconds. # Defaults to $::os_service_default # +# [*rabbit_heartbeat_in_pthread*] +# (Optional) EXPERIMENTAL: Run the health check heartbeat thread +# through a native python thread. By default if this +# option isn't provided the health check heartbeat will +# inherit the execution model from the parent process. By +# example if the parent process have monkey patched the +# stdlib by using eventlet/greenlet then the heartbeat +# will be run through a green thread. +# Defaults to $::os_service_default +# # [*rabbit_use_ssl*] # (optional) Connect over SSL for RabbitMQ # Defaults to $::os_service_default @@ -193,6 +203,7 @@ class congress( $notification_topics = $::os_service_default, $rabbit_heartbeat_timeout_threshold = $::os_service_default, $rabbit_heartbeat_rate = $::os_service_default, + $rabbit_heartbeat_in_pthread = $::os_service_default, $rabbit_use_ssl = $::os_service_default, $rabbit_ha_queues = $::os_service_default, $kombu_ssl_ca_certs = $::os_service_default, @@ -245,6 +256,7 @@ class congress( rabbit_use_ssl => $rabbit_use_ssl, heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, heartbeat_rate => $rabbit_heartbeat_rate, + heartbeat_in_pthread => $rabbit_heartbeat_in_pthread, kombu_reconnect_delay => $kombu_reconnect_delay, kombu_failover_strategy => $kombu_failover_strategy, amqp_durable_queues => $amqp_durable_queues, diff --git a/releasenotes/notes/rabbitmq-heartbeat-over-pthread-a0355cfcb8ff0dfe.yaml b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-a0355cfcb8ff0dfe.yaml new file mode 100644 index 0000000..496d227 --- /dev/null +++ b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-a0355cfcb8ff0dfe.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Allow users to run the RabbitMQ heartbeat over a native python thread in the + oslo.messaging RabbitMQ driver, by using the `rabbit_heartbeat_in_pthread` + option in configuration. diff --git a/spec/classes/congress_init_spec.rb b/spec/classes/congress_init_spec.rb index f48f3d4..324604d 100644 --- a/spec/classes/congress_init_spec.rb +++ b/spec/classes/congress_init_spec.rb @@ -24,7 +24,7 @@ describe 'congress' do is_expected.to contain_congress_config('DEFAULT/rpc_response_timeout').with_value('') is_expected.to contain_congress_config('DEFAULT/control_exchange').with_value('') is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('') - is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') + is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('') is_expected.to contain_congress_config('oslo_messaging_rabbit/kombu_compression').with_value('') end @@ -39,6 +39,7 @@ describe 'congress' do :rabbit_ha_queues => true, :rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_rate => '10', + :rabbit_heartbeat_in_pthread => true, :kombu_compression => 'gzip', } end @@ -47,6 +48,7 @@ describe 'congress' do is_expected.to contain_congress_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') + is_expected.to contain_congress_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true) is_expected.to contain_congress_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip') is_expected.to contain_congress_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') is_expected.to contain_congress_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('')