blob: 22b401c3faddbece321038c0d280c16eaaeb5d00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
namespace :rabbitmq do
desc "setup rabbitmq routing"
task setup: :environment do
require "bunny"
connection = Bunny.new
connection.start
channel = connection.create_channel
# single malwer topic exchange
# routing keys:
# * commands.command_type.(agent_id/fingerprint)
# * commands can be issued for specific agents
# * commands can be issued globally. (e.g. poke a dispostion)
# * events.event_type.agent_id
channel.topic("malwer").tap do |exchange|
# event intake bindings
queue = channel.queue("worker.events", durable: true)
queue.bind(exchange, routing_key: "events.#")
# poke bindings
queue = channel.queue("worker.poke", durable: true)
queue.bind(exchange, routing_key: "commands.poke.#")
# cloud queries bindings
queue = channel.queue("worker.queries", durable: true)
queue.bind(exchange, routing_key: 'events.scanned.#')
end
connection.close
end
end
|