Class: OmfCommon::Comm::AMQP::Topic

Inherits:
Topic
  • Object
show all
Defined in:
lib/omf_common/comm/amqp/amqp_topic.rb

Instance Attribute Summary

Attributes inherited from Topic

#id

Instance Method Summary collapse

Methods inherited from Topic

[], #after, #configure, create, #create, #create_message_and_publish, #error?, #inform, #on_inform, #on_message, #publish, #release, #request, #unsubscribe

Instance Method Details

#addressObject



17
18
19
# File 'lib/omf_common/comm/amqp/amqp_topic.rb', line 17

def address
  @address
end

#on_subscribed(&block) ⇒ Object

Call ‘block’ when topic is subscribed to underlying messaging infrastructure.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/omf_common/comm/amqp/amqp_topic.rb', line 24

def on_subscribed(&block)
  return unless block

  call_now = false
  @lock.synchronize do
    if @subscribed
      call_now = true
    else
      @on_subscribed_handlers << block
    end
  end
  if call_now
    after(0, &block)
  end
end

#to_sObject



13
14
15
# File 'lib/omf_common/comm/amqp/amqp_topic.rb', line 13

def to_s
  @address
end