forked from TheThingsArchive/croft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (30 loc) · 647 Bytes
/
main.go
File metadata and controls
37 lines (30 loc) · 647 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
package main
import (
"log"
)
func main() {
log.Print("Croft is ALIVE")
publisher, err := connectPublisher()
if err != nil {
log.Fatalf("Failed to connect publisher: %s", err.Error())
}
messages := make(chan interface{})
go readUDPMessages(1700, messages)
for msg := range messages {
err = publisher.Publish(msg)
if err != nil {
log.Printf("Failed to publish message %#v: %s", msg, err.Error())
}
}
}
func connectPublisher() (Publisher, error) {
publisher, err := ConnectRabbitPublisher()
if err != nil {
return nil, err
}
err = publisher.Configure()
if err != nil {
return nil, err
}
return publisher, nil
}