Class: RubyRabbitmqJanus::Rabbit::BaseEvent Abstract
- Inherits:
-
Object
- Object
- RubyRabbitmqJanus::Rabbit::BaseEvent
- Defined in:
- lib/rrj/rabbit/base_event.rb
Overview
This class is abstract.
Publish message in RabbitMQ
# Parent class for all publisher This element send and read a message in rabbitmq Queue
Direct Known Subclasses
Instance Attribute Summary collapse
-
#responses ⇒ RubyRabbitmqJanus::Janus::Responses::Response
readonly
Given an array of Janus response.
Instance Method Summary collapse
-
#initialize ⇒ BaseEvent
constructor
Define a base publisher.
Constructor Details
#initialize ⇒ BaseEvent
Define a base publisher
22 23 24 25 26 |
# File 'lib/rrj/rabbit/base_event.rb', line 22 def initialize @responses = [] @semaphore = Semaphore.new @lock = Mutex.new end |
Instance Attribute Details
#responses ⇒ RubyRabbitmqJanus::Janus::Responses::Response (readonly)
Returns Given an array of Janus response.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rrj/rabbit/base_event.rb', line 18 class BaseEvent attr_reader :responses # Define a base publisher def initialize @responses = [] @semaphore = Semaphore.new @lock = Mutex.new end private attr_accessor :semaphore, :lock def return_response @semaphore.wait response = nil @lock.synchronize do response = @responses.shift end response end end |