Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client properties #398

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -542,6 +543,13 @@ Generate with
<td><tt>HUTCH_CHANNEL_PREFETCH</tt></td>
<td><p>The <tt>basic.qos</tt> prefetch value to use.</p></td>
</tr>
<tr>
<td><tt>connection_name</tt></td>
<td>nil</td>
<td>String</td>
<td><tt>HUTCH_CONNECTION_NAME</tt></td>
<td><p><a href="https://www.rabbitmq.com/docs/connections#client-provided-names">Client-Provided Connection Name</a></p></td>
</tr>
<tr>
<td><tt>connection_timeout</tt></td>
<td>11</td>
Expand Down
2 changes: 2 additions & 0 deletions lib/hutch/broker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ 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]
params[:write_timeout] = @config[:write_timeout]
Expand Down
4 changes: 4 additions & 0 deletions lib/hutch/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -171,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,
Expand Down
Loading