Class: RubyRabbitmqJanus::Rabbit::Publisher::BasePublisher Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/rrj/rabbit/publish/base_publisher.rb

Overview

This class is abstract.

Publish message in RabbitMQ

Direct Known Subclasses

Listener, Publisher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBasePublisher

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

#conditionObject (private)

Returns the value of attribute condition.



21
22
23
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 21

def condition
  @condition
end

#lockObject (private)

Returns the value of attribute lock.



21
22
23
# File 'lib/rrj/rabbit/publish/base_publisher.rb', line 21

def lock
  @lock
end

#responseObject (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_responseObject (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