From a030494ae76e6dc9b29bab6453ec4f1f5edfea7c Mon Sep 17 00:00:00 2001 From: Rustam Sharshenov Date: Mon, 6 May 2024 20:03:27 +0100 Subject: [PATCH 1/2] Allow to configure connection_name --- README.md | 7 +++++++ lib/hutch/broker.rb | 1 + lib/hutch/config.rb | 3 +++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index ae71d38..dabfad8 100644 --- a/README.md +++ b/README.md @@ -542,6 +542,13 @@ Generate with HUTCH_CHANNEL_PREFETCH

The basic.qos prefetch value to use.

+ + connection_name + nil + String + HUTCH_CONNECTION_NAME +

Client-Provided Connection Name

+ connection_timeout 11 diff --git a/lib/hutch/broker.rb b/lib/hutch/broker.rb index ec24ee7..c21a7d1 100644 --- a/lib/hutch/broker.rb +++ b/lib/hutch/broker.rb @@ -298,6 +298,7 @@ def connection_params params[:tls_ca_certificates] = @config[:mq_tls_ca_certificates] end params[:heartbeat] = @config[:heartbeat] + params[:connection_name] = @config[:connection_name] params[:connection_timeout] = @config[:connection_timeout] params[:read_timeout] = @config[:read_timeout] params[:write_timeout] = @config[:write_timeout] diff --git a/lib/hutch/config.rb b/lib/hutch/config.rb index 253c7a3..815a6a9 100644 --- a/lib/hutch/config.rb +++ b/lib/hutch/config.rb @@ -86,6 +86,9 @@ def self.boolean_setting(name, default_value) # Default: `0`, no limit. See Bunny and RabbitMQ documentation. number_setting :channel_prefetch, 0 + # [Client-Provided Connection Name](https://www.rabbitmq.com/docs/connections#client-provided-names) + string_setting :connection_name, nil + # Bunny's socket open timeout number_setting :connection_timeout, 11 From 7c779197d906de78d93f8e780c86740fcdb5af20 Mon Sep 17 00:00:00 2001 From: Rustam Sharshenov Date: Mon, 6 May 2024 20:22:33 +0100 Subject: [PATCH 2/2] Allow to configure client properties --- README.md | 1 + lib/hutch/broker.rb | 1 + lib/hutch/config.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index dabfad8..40121aa 100644 --- a/README.md +++ b/README.md @@ -406,6 +406,7 @@ Known configuration parameters are: * `error_acknowledgements`: a chain of responsibility of objects that acknowledge/reject/requeue messages when an exception happens, see classes in `Hutch::Acknowledgements`. * `mq_exchange`: exchange to use for publishing (default: `hutch`) + * `mq_client_properties`: Bunny's [client properties](https://www.rabbitmq.com/docs/connections#capabilities) (default: `{}`) * `heartbeat`: [RabbitMQ heartbeat timeout](http://rabbitmq.com/heartbeats.html) (default: `30`) * `connection_timeout`: Bunny's socket open timeout (default: `11`) * `read_timeout`: Bunny's socket read timeout (default: `11`) diff --git a/lib/hutch/broker.rb b/lib/hutch/broker.rb index c21a7d1..dc534b5 100644 --- a/lib/hutch/broker.rb +++ b/lib/hutch/broker.rb @@ -298,6 +298,7 @@ def connection_params params[:tls_ca_certificates] = @config[:mq_tls_ca_certificates] end params[:heartbeat] = @config[:heartbeat] + params[:client_properties] = @config[:mq_client_properties] params[:connection_name] = @config[:connection_name] params[:connection_timeout] = @config[:connection_timeout] params[:read_timeout] = @config[:read_timeout] diff --git a/lib/hutch/config.rb b/lib/hutch/config.rb index 815a6a9..40bde7b 100644 --- a/lib/hutch/config.rb +++ b/lib/hutch/config.rb @@ -174,6 +174,7 @@ def self.initialize(params = {}) # @return [Hash] def self.default_config @settings_defaults.merge({ + mq_client_properties: {}, mq_exchange_options: {}, mq_tls_cert: nil, mq_tls_key: nil,