Class: MQBench::STOMP
Constant Summary
Constants inherited from Client
Instance Method Summary collapse
-
#initialize(args) ⇒ STOMP
constructor
A new instance of STOMP.
- #recv_msg ⇒ Object
- #send_msg ⇒ Object
Constructor Details
#initialize(args) ⇒ STOMP
Returns a new instance of STOMP.
5 6 7 8 9 10 11 12 13 |
# File 'lib/mqbench/stomp.rb', line 5 def initialize(args) @port = 61613 @user = 'guest' @pass = 'guest' super(args) @broker = Stomp::Connection.open(@user, @pass, @host, @port) end |
Instance Method Details
#recv_msg ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mqbench/stomp.rb', line 21 def recv_msg @broker.subscribe(QNAME, {:ack => 'client'}) cnt = 0 loop do @broker.receive cnt += 1 if cnt >= @count break end end end |
#send_msg ⇒ Object
15 16 17 18 19 |
# File 'lib/mqbench/stomp.rb', line 15 def send_msg (1..@count).each do |x| @broker.publish(QNAME, 'a' * @size) end end |