blob: 6c8e3d2f3c16fcc2214682eb62c5a8e92cce18f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
namespace :rabbitmq do
desc "setup rabbitmq routing"
task setup: :environment do
require "bunny"
connection = Bunny.new
connection.start
channel = connection.create_channel
# create exchange
exchange = channel.fanout("malwer.events")
# get or create queue (note the durable setting)
queue = channel.queue("dashboard.events", durable: true)
# bind queue to exchange
queue.bind("malwer.events")
connection.close
end
end
|