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
Instance Attribute Summary collapse
-
#condition ⇒ Object
private
Returns the value of attribute condition.
-
#lock ⇒ Object
private
Returns the value of attribute lock.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize ⇒ BasePublisher
constructor
Define a base publisher.
-
#return_response ⇒ Object
private
return an response when signal is trigger.
Constructor Details
#initialize ⇒ BasePublisher
Define a base publisher
12 13 14 15 16 17 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 12 def initialize Tools::Log.instance.debug 'Create an publisher' @response = nil @condition = ConditionVariable.new @lock = Mutex.new end |
Instance Attribute Details
#condition ⇒ Object (private)
Returns the value of attribute condition.
21 22 23 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 21 def condition @condition end |
#lock ⇒ Object (private)
Returns the value of attribute lock.
21 22 23 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 21 def lock @lock end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 9 def response @response end |
Instance Method Details
#return_response ⇒ Object (private)
return an response when signal is trigger
24 25 26 27 28 29 30 |
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 24 def return_response Tools::Log.instance.debug 'Waiting an response ...' @lock.synchronize do @condition.wait(@lock) response end end |