Class: RubyRabbitmqJanus::Janus::Event
- Includes:
- Singleton
- Defined in:
- lib/rrj/janus/threads/event.rb
Overview
For listen standard queue ("from-janus" by default)
Instance Attribute Summary
Attributes inherited from OneThread
Instance Method Summary collapse
-
#initialize ⇒ Event
constructor
Initialize Event object.
-
#initialize_thread ⇒ Object
private
Intialize an listen to queue.
-
#listen ⇒ Object
Start listen queue and return each message.
-
#listen_live ⇒ Object
private
Listen q queue "from-janus".
-
#start_transaction ⇒ Object
private
Start a transaction with Rabbit an Janus.
Methods inherited from OneThread
Constructor Details
Instance Method Details
#initialize_thread ⇒ Object (private)
Intialize an listen to queue
32 33 34 35 36 37 |
# File 'lib/rrj/janus/threads/event.rb', line 32 def initialize_thread start_transaction rescue Interrupt Tools::Log.instance.info 'Stop to listen standard queue' rabbit.close end |
#listen ⇒ Object
Start listen queue and return each message
19 20 21 22 |
# File 'lib/rrj/janus/threads/event.rb', line 19 def listen lock.synchronize { condition.wait(lock) } @response end |
#listen_live ⇒ Object (private)
Listen q queue "from-janus"
27 28 29 |
# File 'lib/rrj/janus/threads/event.rb', line 27 def listen_live start_thread end |
#start_transaction ⇒ Object (private)
Start a transaction with Rabbit an Janus
40 41 42 43 44 45 46 |
# File 'lib/rrj/janus/threads/event.rb', line 40 def start_transaction rabbit.transaction_long do publisher = Rabbit::Publisher::Listener.new(rabbit) @response = publisher.listen_events lock.synchronize { condition.signal } end end |