Class: RubyRabbitmqJanus::Rabbit::Publisher::BasePublisher Abstract
- Inherits:
-
Object
- Object
- RubyRabbitmqJanus::Rabbit::Publisher::BasePublisher
- Defined in:
- lib/rrj/rabbit/publish/base_publisher.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
Instance Attribute Summary collapse
-
#response ⇒ RubyRabbitmqJanus::Janus::Responses::Response
readonly
Given a Janus response.
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Instance Method Summary collapse
-
#initialize ⇒ BasePublisher
constructor
Define a base publisher.
Constructor Details
#initialize ⇒ BasePublisher
Define a base publisher
23 24 25 26 27 28 29 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 23 def initialize @responses = [] @semaphore = Semaphore.new @lock = Mutex.new rescue raise Errors::Rabbit::BasePublisher::Initialize end |
Instance Attribute Details
#response ⇒ RubyRabbitmqJanus::Janus::Responses::Response (readonly)
Returns Given a Janus response.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 19 class BasePublisher attr_reader :responses # Define a base publisher def initialize @responses = [] @semaphore = Semaphore.new @lock = Mutex.new rescue raise Errors::Rabbit::BasePublisher::Initialize end private attr_accessor :semaphore, :lock def return_response @semaphore.wait response = nil @lock.synchronize do response = @responses.shift end response end end |
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
20 21 22 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 20 def responses @responses end |