2021-02-01 10:13:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"log"
|
2021-02-05 06:25:12 +00:00
|
|
|
"net/http"
|
2021-02-01 10:13:38 +00:00
|
|
|
"os"
|
|
|
|
|
2021-02-05 06:25:12 +00:00
|
|
|
_ "net/http/pprof"
|
|
|
|
|
2021-02-01 10:13:38 +00:00
|
|
|
"github.com/RaaLabs/steward"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
nodeName := flag.String("node", "0", "some unique string to identify this Edge unit")
|
|
|
|
brokerAddress := flag.String("brokerAddress", "0", "the address of the message broker")
|
2021-02-05 06:25:12 +00:00
|
|
|
profilingPort := flag.String("profilingPort", "", "The number of the profiling port")
|
2021-02-22 08:33:37 +00:00
|
|
|
promHostAndPort := flag.String("promHostAndPort", ":2112", "host and port for prometheus listener, e.g. localhost:2112")
|
2021-02-19 10:07:09 +00:00
|
|
|
//isCentral := flag.Bool("isCentral", false, "used to indicate that this is the central master that will subscribe to error message subjects")
|
2021-02-01 10:13:38 +00:00
|
|
|
flag.Parse()
|
|
|
|
|
2021-02-05 06:25:12 +00:00
|
|
|
if *profilingPort != "" {
|
|
|
|
// TODO REMOVE: Added for profiling
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
http.ListenAndServe("localhost:"+*profilingPort, nil)
|
|
|
|
}()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-02-22 08:33:37 +00:00
|
|
|
s, err := steward.NewServer(*brokerAddress, *nodeName, *promHostAndPort)
|
2021-02-01 10:13:38 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Printf("error: failed to connect to broker: %v\n", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2021-02-10 04:11:48 +00:00
|
|
|
// Start the messaging server
|
|
|
|
go s.Start()
|
2021-02-01 10:13:38 +00:00
|
|
|
|
|
|
|
select {}
|
|
|
|
}
|