class RPCBench::Stomp::Server

Public Class Methods

new(opts) click to toggle source
# File lib/rpc_bench/driver_stomp.rb, line 31
def initialize opts
  @opts = opts
end

Public Instance Methods

run() click to toggle source
# 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