-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
32 lines (26 loc) · 810 Bytes
/
main.go
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
package main
import (
"flag"
"log"
"os"
)
func main() {
// Parse CLI options
configfile := flag.String("config", "/etc/orc-agent/config.json",
"path to orc-agent's json config file")
logfile := flag.String("logfile", "/var/log/orc-agent.log",
"where orc-agent should log to")
flag.Parse()
// Set up our logger
f, _ := os.Create(*logfile)
log.SetOutput(f)
defer f.Close() // clean up after ourselves when we exit.
// Load our config
config := loadConfig(*configfile)
// Connect to rabbitmq broker
conn := amqpConnect(config.Amqpurl)
// Subscribe to queues, and call handleMsg for all incoming messages
for msg := range merge(amqpFollowQueues(conn, config.Queues)) {
handleMsg(config.Handlerdir, msg)
}
}