Class: RPCBench::Stomp::Server
- Defined in:
- lib/rpc_bench/driver_stomp.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
Methods inherited from Driver
Constructor Details
#initialize(opts) ⇒ Server
Returns a new instance of Server.
31 32 33 |
# File 'lib/rpc_bench/driver_stomp.rb', line 31 def initialize opts @opts = opts end |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rpc_bench/driver_stomp.rb', line 35 def run conn = ::Stomp::Connection.open('guest', 'guest', @opts[:host], @opts[:port]) conn.subscribe RPCBench::Stomp::QNAME loop do msg = conn.receive reply = @handler.callback(msg.body.to_i) conn.publish(msg.headers['reply-to'], reply.to_s) end end |