diff --git a/spec/amqproxy_spec.cr b/spec/amqproxy_spec.cr index 7936981..6d93678 100644 --- a/spec/amqproxy_spec.cr +++ b/spec/amqproxy_spec.cr @@ -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 diff --git a/src/amqproxy/client.cr b/src/amqproxy/client.cr index b7c718a..26c37ca 100644 --- a/src/amqproxy/client.cr +++ b/src/amqproxy/client.cr @@ -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