I'm sending lots of data to my app through JMeter.
My subscribe block and the publisher look like this:
BunnyStarter.start_bunny_components
cons = BunnyStarter.queue.subscribe do |delivery_info, metadata, payload|
method_calling ( payload )
cons.cancel
end
BunnyStarter.exchange.publish(body.to_json, routing_key: BunnyStarter.queue.name)
And my BunnyStarter class:
def self.start_bunny_components
if @@conn.nil?
@@conn = Bunny.new
@@conn.start
@@ch = @@conn.create_channel
@@queue = @@ch.queue("dump_probe_queue")
@@exchange = @@ch.default_exchange
end
end
The problem is, although I call consumer.cancel
after method_calling
, in my Rabbit MQ admin I still see that I get like one thousand consumers created in about 6 minutes.
Is that because of the rate and the amount of data I'm sending?
How can I improve this?