Method: HornetQ::Client::SessionPool#requestor

Defined in:
lib/hornetq/client/session_pool.rb

#requestor(address, &block) ⇒ Object

Obtain a session from the pool and create a Client::Requestor. Pass both into the supplied block. Once the block is complete the requestor is closed and the session is returned to the pool.

See HornetQ::Client::Requestor for more information on the requestor

Example

session_pool.requestor(params) do |session, requestor|
  ....
end


123
124
125
126
127
128
129
130
131
132
133
# File 'lib/hornetq/client/session_pool.rb', line 123

def requestor(address, &block)
  session do |s|
    requestor = nil
    begin
      requestor = s.create_requestor(address)
      block.call(s, requestor)
    ensure
      requestor.close
    end
  end
end