Class: PublisherRenoteDac::Publisher

Inherits:
Object
  • Object
show all
Defined in:
app/services/publisher_renote_dac/publisher.rb

Class Method Summary collapse

Class Method Details

.channelObject



9
10
11
# File 'app/services/publisher_renote_dac/publisher.rb', line 9

def self.channel
  @channel ||= connection.create_channel
end

.connectionObject



13
14
15
16
17
# File 'app/services/publisher_renote_dac/publisher.rb', line 13

def self.connection
  @connection ||= Bunny.new().tap do |c|
    c.start
  end
end

.publish(exchange, message = {}) ⇒ Object



4
5
6
7
# File 'app/services/publisher_renote_dac/publisher.rb', line 4

def self.publish(exchange, message = {})
  x = channel.fanout(exchange)
  x.publish(message.to_json)
end