Class: Primer::Bus::AMQP

Inherits:
Primer::Bus show all
Defined in:
lib/primer/bus/amqp.rb

Instance Method Summary collapse

Methods inherited from Primer::Bus

#distribute, #unsubscribe, #unsubscribe_all

Constructor Details

#initialize(config = {}) ⇒ AMQP

Returns a new instance of AMQP.



8
9
10
11
# File 'lib/primer/bus/amqp.rb', line 8

def initialize(config = {})
  @config = config
  super()
end

Instance Method Details

#publish(topic, message) ⇒ Object



13
14
15
16
# File 'lib/primer/bus/amqp.rb', line 13

def publish(topic, message)
  tuple = [topic.to_s, message]
  queue.publish(Primer.serialize(tuple))
end

#subscribe(*args, &block) ⇒ Object



18
19
20
21
# File 'lib/primer/bus/amqp.rb', line 18

def subscribe(*args, &block)
  bind
  super
end