Class: RubyRabbitmqJanus::Janus::TransactionHandle
- Inherits:
-
TransactionSession
- Object
- Transaction
- TransactionSession
- RubyRabbitmqJanus::Janus::TransactionHandle
- Defined in:
- lib/rrj/janus/transactions/handle.rb
Overview
This class work with janus and send a series of message
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Transaction
#handle, #publish, #rabbit, #response, #session
Instance Method Summary collapse
-
#handle_connect(exclusive) ⇒ Object
Initialize connection to Rabbit and Janus.
-
#handle_connect_and_stop(exclusive) ⇒ Object
Initialize connection to Rabbit and Janus and close after sending an received a response.
-
#handle_running_stop ⇒ Object
Stop an handle running.
-
#publish_message_handle(type, options = {}) ⇒ Object
Publish an message in handle.
Methods inherited from TransactionSession
Methods inherited from Transaction
#choose_queue, #connect, #create_handle, #initialize, #send_a_message
Constructor Details
This class inherits a constructor from RubyRabbitmqJanus::Janus::Transaction
Instance Method Details
#handle_connect(exclusive) ⇒ Object
Initialize connection to Rabbit and Janus
9 10 11 12 13 14 15 |
# File 'lib/rrj/janus/transactions/handle.rb', line 9 def handle_connect(exclusive) rabbit.transaction_long do choose_queue(exclusive) create_handle yield end end |
#handle_connect_and_stop(exclusive) ⇒ Object
Initialize connection to Rabbit and Janus and close after sending an received a response
19 20 21 22 23 24 25 |
# File 'lib/rrj/janus/transactions/handle.rb', line 19 def handle_connect_and_stop(exclusive) rabbit.transaction_short do choose_queue(exclusive) create_handle yield end end |
#handle_running_stop ⇒ Object
Stop an handle running
28 29 30 |
# File 'lib/rrj/janus/transactions/handle.rb', line 28 def handle_running_stop ('base::detach') end |
#publish_message_handle(type, options = {}) ⇒ Object
Publish an message in handle
33 34 35 36 37 |
# File 'lib/rrj/janus/transactions/handle.rb', line 33 def (type, = {}) opts = { 'session_id' => session, 'handle_id' => handle } msg = Janus::Message.new(type, opts.merge!()) Janus::Response.new(publish.(msg)) end |