RabbitMQ: Add support for quorum queue options

Depends-on: https://review.opendev.org/894866
Change-Id: I55b5eb5d6139f464f633d5c13827fea91378e3b7
This commit is contained in:
Takashi Kajinami 2023-09-14 22:48:24 +09:00
parent 02d4ae58d9
commit 122686e238
3 changed files with 69 additions and 26 deletions

View File

@ -66,6 +66,24 @@
# (optional) Use HA queues in RabbitMQ.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_queue*]
# (Optional) Use quorum queues in RabbitMQ.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_delivery_limit*]
# (Optional) Each time a message is rdelivered to a consumer, a counter is
# incremented. Once the redelivery count exceeds the delivery limit
# the message gets dropped or dead-lettered.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_max_memory_length*]
# (Optional) Limit the number of messages in the quorum queue.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_max_memory_bytes*]
# (Optional) Limit the number of memory bytes used by the quorum queue.
# Defaults to $facts['os_service_default']
#
# [*rabbit_heartbeat_timeout_threshold*]
# (optional) Number of seconds after which the RabbitMQ broker is considered
# down if the heartbeat keepalive fails. Any value >0 enables heartbeats.
@ -248,6 +266,10 @@ class barbican::api (
$rabbit_heartbeat_rate = $facts['os_service_default'],
$rabbit_heartbeat_in_pthread = $facts['os_service_default'],
$rabbit_ha_queues = $facts['os_service_default'],
$rabbit_quorum_queue = $facts['os_service_default'],
$rabbit_quorum_delivery_limit = $facts['os_service_default'],
$rabbit_quorum_max_memory_length = $facts['os_service_default'],
$rabbit_quorum_max_memory_bytes = $facts['os_service_default'],
$amqp_durable_queues = $facts['os_service_default'],
$enable_queue = $facts['os_service_default'],
$queue_namespace = $facts['os_service_default'],
@ -307,19 +329,23 @@ class barbican::api (
}
oslo::messaging::rabbit {'barbican_config':
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,
kombu_compression => $kombu_compression,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
rabbit_ha_queues => $rabbit_ha_queues,
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,
kombu_compression => $kombu_compression,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
rabbit_ha_queues => $rabbit_ha_queues,
rabbit_quorum_queue => $rabbit_quorum_queue,
rabbit_quorum_delivery_limit => $rabbit_quorum_delivery_limit,
rabbit_quorum_max_memory_length => $rabbit_quorum_max_memory_length,
rabbit_quorum_max_memory_bytes => $rabbit_quorum_max_memory_bytes,
}
oslo::messaging::default { 'barbican_config':

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``barbican::api`` class now supports options for quorum queues in
RabbitMQ.

View File

@ -38,6 +38,10 @@ describe 'barbican::api' do
:rabbit_heartbeat_rate => '<SERVICE DEFAULT>',
:rabbit_heartbeat_in_pthread => '<SERVICE DEFAULT>',
:rabbit_ha_queues => '<SERVICE DEFAULT>',
:rabbit_quorum_queue => '<SERVICE DEFAULT>',
:rabbit_quorum_delivery_limit => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_length => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_bytes => '<SERVICE DEFAULT>',
:amqp_durable_queues => '<SERVICE DEFAULT>',
:max_allowed_secret_in_bytes => '<SERVICE DEFAULT>',
:max_allowed_request_size_in_bytes => '<SERVICE DEFAULT>',
@ -86,6 +90,10 @@ describe 'barbican::api' do
:rabbit_heartbeat_rate => '10',
:rabbit_heartbeat_in_pthread => true,
:rabbit_ha_queues => true,
:rabbit_quorum_queue => true,
:rabbit_quorum_delivery_limit => 3,
:rabbit_quorum_max_memory_length => 5,
:rabbit_quorum_max_memory_bytes => 1073741824,
:amqp_durable_queues => true,
:enable_queue => true,
:queue_namespace => 'barbican1',
@ -166,19 +174,23 @@ describe 'barbican::api' do
:topics => param_hash[:notification_topics]
)
is_expected.to contain_oslo__messaging__rabbit('barbican_config').with(
:rabbit_use_ssl => param_hash[:rabbit_use_ssl],
:heartbeat_timeout_threshold => param_hash[:rabbit_heartbeat_timeout_threshold],
:heartbeat_rate => param_hash[:rabbit_heartbeat_rate],
:heartbeat_in_pthread => param_hash[:rabbit_heartbeat_in_pthread],
:kombu_reconnect_delay => param_hash[:kombu_reconnect_delay],
:kombu_failover_strategy => param_hash[:kombu_failover_strategy],
:amqp_durable_queues => param_hash[:amqp_durable_queues],
:kombu_compression => param_hash[:kombu_compression],
:kombu_ssl_ca_certs => param_hash[:kombu_ssl_ca_certs],
:kombu_ssl_certfile => param_hash[:kombu_ssl_certfile],
:kombu_ssl_keyfile => param_hash[:kombu_ssl_keyfile],
:kombu_ssl_version => param_hash[:kombu_ssl_version],
:rabbit_ha_queues => param_hash[:rabbit_ha_queues],
:rabbit_use_ssl => param_hash[:rabbit_use_ssl],
:heartbeat_timeout_threshold => param_hash[:rabbit_heartbeat_timeout_threshold],
:heartbeat_rate => param_hash[:rabbit_heartbeat_rate],
:heartbeat_in_pthread => param_hash[:rabbit_heartbeat_in_pthread],
:kombu_reconnect_delay => param_hash[:kombu_reconnect_delay],
:kombu_failover_strategy => param_hash[:kombu_failover_strategy],
:amqp_durable_queues => param_hash[:amqp_durable_queues],
:kombu_compression => param_hash[:kombu_compression],
:kombu_ssl_ca_certs => param_hash[:kombu_ssl_ca_certs],
:kombu_ssl_certfile => param_hash[:kombu_ssl_certfile],
:kombu_ssl_keyfile => param_hash[:kombu_ssl_keyfile],
:kombu_ssl_version => param_hash[:kombu_ssl_version],
:rabbit_ha_queues => param_hash[:rabbit_ha_queues],
:rabbit_quorum_queue => param_hash[:rabbit_quorum_queue],
:rabbit_quorum_delivery_limit => param_hash[:rabbit_quorum_delivery_limit],
:rabbit_quorum_max_memory_length => param_hash[:rabbit_quorum_max_memory_length],
:rabbit_quorum_max_memory_bytes => param_hash[:rabbit_quorum_max_memory_bytes],
)
end