Class: RubyRabbitmqJanus::Process::Concurrencies::Event
- Inherits:
-
Concurrency
- Object
- Concurrency
- RubyRabbitmqJanus::Process::Concurrencies::Event
- Defined in:
- lib/rrj/process/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.
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.
17 18 19 20 21 22 |
# File 'lib/rrj/process/event.rb', line 17 def initialize super @thread = Thread.new { initialize_thread } rescue raise Errors::Process::Event::Initializer end |
Instance Method Details
#run(&block) ⇒ Thread
Create a thread for execute a block code in a thread
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rrj/process/event.rb', line 31 def run(&block) @thread.join Thread.new do loop do @thread.thread_variable_get(NAME_VAR).listen_events(&block) end end rescue raise Errors::Process::Event::Run end |