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

Add support for setMaxInboundMessageBodySize #164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Changes Between 4.6.0 and 4.7.0 (under development)

### Support for setting maximum inbound message size

Add configuration option to set the `maxInboundMessageBodySize` on the ConnectionFactory

## Changes Between 4.5.0 and 4.6.0 (Nov 10, 2023)

### RabbitMQ Java Client Upgrade
Expand Down
3 changes: 3 additions & 0 deletions lib/march_hare/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Session
# @option options [Logger] :logger The logger. If missing, one is created using :log_file and :log_level.
# @option options [IO, String] :log_file The file or path to use when creating a logger. Defaults to STDOUT.
# @option options [Integer] :log_level The log level to use when creating a logger. Defaults to LOGGER::WARN
# @option options [Integer] :max_inbound_message_body_size Maximum allowed size of an incoming message body. Defaults to 64MiB
#
# @see http://rubymarchhare.info/articles/connecting.html Connecting to RabbitMQ guide
def self.connect(options = {})
Expand All @@ -83,6 +84,8 @@ def self.connect(options = {})

cf.thread_factory = thread_factory_from(options) if include_thread_factory?(options)

cf.max_inbound_message_body_size = options[:max_inbound_message_body_size].to_i if options[:max_inbound_message_body_size]

tls = (options[:ssl] || options[:tls])
case tls
when true then
Expand Down
7 changes: 7 additions & 0 deletions spec/higher_level_api/integration/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ def newThread(runnable)
c.close
end

it "lets you specify a maximum inbound message size" do
c = MarchHare.connect(max_inbound_message_body_size: 64000)
expect(c).to be_connected
c.close
end


it "lets you specify exception handler" do
class ExceptionHandler < com.rabbitmq.client.impl.DefaultExceptionHandler
include com.rabbitmq.client.ExceptionHandler
Expand Down