main
1class Publisher
2 def self.publish(message)
3 exchange = channel.topic("malwer")
4 exchange.publish(message.to_json, routing_key: message.routing_key)
5 end
6
7 def self.channel
8 @channel ||= connection.create_channel
9 end
10
11 def self.connection
12 @connection ||= Bunny.new.tap do |connection|
13 connection.start
14 end
15 end
16end