Skip to content

Commit

Permalink
fixup! Support for passing Connection::Blocked frames to downstream c…
Browse files Browse the repository at this point in the history
…lients
  • Loading branch information
carlhoerberg committed Mar 9, 2024
1 parent 8443df7 commit a9f41a0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ shards:

amqp-client:
git: https://github.com/cloudamqp/amqp-client.cr.git
version: 1.2.1
version: 1.2.2

24 changes: 24 additions & 0 deletions spec/amqproxy_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,28 @@ describe AMQProxy::Server do
s.stop_accepting_clients
end
end

it "passes connection blocked frames to clients" do
s = AMQProxy::Server.new("127.0.0.1", 5672, false)
done = Channel(Nil).new
begin
spawn { s.listen("127.0.0.1", 5673) }
Fiber.yield
AMQP::Client.start("amqp://localhost:5673") do |conn|
conn.on_blocked do
done.send nil
system("#{MAYBE_SUDO}rabbitmqctl set_vm_memory_high_watermark 0.8 > /dev/null").should be_true
end
conn.on_unblocked do
done.send nil
end
ch = conn.channel
system("#{MAYBE_SUDO}rabbitmqctl set_vm_memory_high_watermark 0.001 > /dev/null").should be_true
ch.basic_publish "foobar", "amq.fanout"
2.times { done.receive }
end
ensure
s.stop_accepting_clients
end
end
end

0 comments on commit a9f41a0

Please sign in to comment.