Class: RubyRabbitmqJanus::Janus::Concurrencies::Event
- Inherits:
-
Concurrency
- Object
- Concurrency
- RubyRabbitmqJanus::Janus::Concurrencies::Event
- Includes:
- Singleton
- Defined in:
- lib/rrj/janus/processus/event.rb
Overview
# Listen public queue to all Janus instance
Listen standard queue and sending a block code to thread listen. The default queue is configured in config file.
Direct Known Subclasses
Constant Summary collapse
- NAME_VAR =
:publish
Instance Method Summary collapse
-
#initialize ⇒ Event
constructor
A new instance of Event.
-
#run(&block) ⇒ Thread
Create a thread for execute a block code in a thread.
Constructor Details
#initialize ⇒ Event
Returns a new instance of Event.
19 20 21 22 23 24 |
# File 'lib/rrj/janus/processus/event.rb', line 19 def initialize super @thread = Thread.new { initialize_thread } rescue raise Errors::Janus::Event::Initializer end |
Instance Method Details
#run(&block) ⇒ Thread
Create a thread for execute a block code in a thread
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rrj/janus/processus/event.rb', line 33 def run(&block) @thread.join Thread.new do loop do @thread.thread_variable_get(NAME_VAR).listen_events(&block) end end rescue raise Errors::Janus::Event::Run end |