Skip to content

Commit df4b17f

Browse files
committed
negotiate frame_max 4096 with downstream clients
to match the upstream connection frame_max
1 parent bba0571 commit df4b17f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

spec/amqproxy_spec.cr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,21 @@ describe AMQProxy::Server do
250250
s.stop_accepting_clients
251251
end
252252
end
253+
254+
it "supports publishing large messages" do
255+
s = AMQProxy::Server.new("127.0.0.1", 5672, false)
256+
begin
257+
spawn { s.listen("127.0.0.1", 5673) }
258+
Fiber.yield
259+
AMQP::Client.start("amqp://localhost:5673") do |conn|
260+
ch = conn.channel
261+
q = ch.queue
262+
q.publish_confirm Bytes.new(10240)
263+
msg = q.get.not_nil!("should not be nil")
264+
msg.body_io.bytesize.should eq 10240
265+
end
266+
ensure
267+
s.stop_accepting_clients
268+
end
269+
end
253270
end

src/amqproxy/client.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ module AMQProxy
242242
else raise "Unsupported authentication mechanism: #{start_ok.mechanism}"
243243
end
244244

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

0 commit comments

Comments
 (0)