Hi,

I'm trying to setup some basic test scripts using the QPID ruby client and  
RabbitMQ/OpenAMQ. I can now get the client to publish/consume messages to both 
brokers.

All seems to work well until I increase the number of messages from say 1000 to 
10,000. When set to 1000 the messages fly through and get consumed within a few 
seconds. However, when I increase the number the actual rate at which the 
messages are consumed drops down considerably. My test (based on Gordon Sim's 
example) code is very simple. Is there anything in particular I'm doing wrong 
here?

Sender:

require "qpid"
include Qpid

spec = Spec.load(ARGV[0])
c = Client.new("0.0.0.0", 5672, spec)
c.start("\0guest\0guest", mechanism="PLAIN")
ch = c.channel(1)
ch.channel_open()
ch.queue_declare(:queue => "test-queue")

1000.times { |i|
content = Qpid::Content.new({}, "Test Message# #{i}")
ch.basic_publish(:routing_key => "test-queue", :content => content)}
ch.channel_close(:reply_code => 200, :reply_text => "Ok")


Receiver:

require "qpid"
include Qpid

spec = Spec.load(ARGV[0])
c = Client.new("0.0.0.0", 5672, spec)
c.start("\0guest\0guest", mechanism="PLAIN")
ch = c.channel(1)
ch.channel_open()
ch.queue_declare(:queue => "test-queue")
ch.basic_consume(:queue => "test-queue", :consumer_tag => "ctag")

while true
    msg = c.queue("ctag").pop()
    print "#{msg.content.body}\n"
    ch.basic_ack(msg.delivery_tag)
    sleep 0.00001
end
ch.channel_close(:reply_code => 200, :reply_text => "Ok")


Regards,

Carl

Reply via email to