Sha256: 4083755948d1e191d3af19f9f0d716ba6f1edb2c63371f091e801b4ca65f9fd9
Contents?: true
Size: 938 Bytes
Versions: 8
Compression:
Stored size: 938 Bytes
Contents
module Bunnish::Command module Count def self.run(argv, input_stream=$stdin, output_stream=$stdout) params = Bunnish.parse_opts(argv) host = params[:host] port = params[:port] user = params[:user] password = params[:password] durable = params[:durable] queue_name = argv.shift if queue_name.nil? Bunnish.logger.error("queue-name is not set") return 1 end bunny = Bunny.new(:logging => false, :spec => '09', :host=>host, :port=>port, :user=>user, :pass=>password) # start a communication session with the amqp server bunny.start # create/get queue queue = bunny.queue(queue_name, :durable=>durable) # remain_count = queue.status[:message_count] output_stream.puts queue.status[:message_count] # Close client bunny.stop end end end
Version data entries
8 entries across 8 versions & 1 rubygems