Skip to content

Commit

Permalink
negotiate frame_max 4096 with downstream clients
Browse files Browse the repository at this point in the history
to match the upstream connection frame_max
  • Loading branch information
carlhoerberg committed May 11, 2024
1 parent bba0571 commit df4b17f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions spec/amqproxy_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,21 @@ describe AMQProxy::Server do
s.stop_accepting_clients
end
end

it "supports publishing large messages" do
s = AMQProxy::Server.new("127.0.0.1", 5672, false)
begin
spawn { s.listen("127.0.0.1", 5673) }
Fiber.yield
AMQP::Client.start("amqp://localhost:5673") do |conn|
ch = conn.channel
q = ch.queue
q.publish_confirm Bytes.new(10240)
msg = q.get.not_nil!("should not be nil")
msg.body_io.bytesize.should eq 10240
end
ensure
s.stop_accepting_clients
end
end
end
2 changes: 1 addition & 1 deletion src/amqproxy/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module AMQProxy
else raise "Unsupported authentication mechanism: #{start_ok.mechanism}"
end

tune = AMQ::Protocol::Frame::Connection::Tune.new(frame_max: 131072_u32, channel_max: UInt16::MAX, heartbeat: 0_u16)
tune = AMQ::Protocol::Frame::Connection::Tune.new(frame_max: 4096_u32, channel_max: UInt16::MAX, heartbeat: 0_u16)
tune.to_io(socket, IO::ByteFormat::NetworkEndian)
socket.flush

Expand Down

0 comments on commit df4b17f

Please sign in to comment.