-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (31 loc) · 796 Bytes
/
main.go
File metadata and controls
41 lines (31 loc) · 796 Bytes
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
33
34
35
36
37
38
39
40
41
// Package main implements the example.
package main
import (
"log"
"os"
"path/filepath"
"github.com/udhos/refresh/refresh"
)
func main() {
amqpURLEnv := "AMQP_URL"
amqpURL := "amqp://guest:guest@rabbitmq:5672/"
amqpURLValue := os.Getenv(amqpURLEnv)
if amqpURLValue != "" {
amqpURL = amqpURLValue
}
log.Printf("%s='%s' using amqpURL='%s'", amqpURLEnv, amqpURLValue, amqpURL)
me := filepath.Base(os.Args[0])
debug := true
options := refresh.Options{
AmqpURL: amqpURL,
ConsumerTag: me,
Applications: []string{"#"},
Debug: debug,
}
// "#" means receive notification for all applications
refresher := refresh.New(options)
for app := range refresher.C {
log.Printf("refresh: received notification for application='%s'", app)
}
refresher.Close()
}