コード例 #1
0
func main() {
	cmdsToStop = []*exec.Cmd{}

	registerSignalHandler()
	nats = natsrunner.NewNATSRunner(4222)
	nats.Start()

	fakeCC := desiredstateserver.NewDesiredStateServer()
	go fakeCC.SpinUp(6001)

	// etcd = storerunner.NewETCDClusterRunner(4001, 1)
	// etcd.Start()
	conf, _ := config.FromFile("./config.json")
	adapter := storeadapter.NewETCDStoreAdapter(conf.StoreURLs, workerpool.NewWorkerPool(30))
	adapter.Connect()
	store = storepackage.NewStore(conf, adapter, fakelogger.NewFakeLogger())

	r := rand.New(rand.NewSource(time.Now().Unix()))
	num, err := strconv.Atoi(os.Args[1])
	if err != nil {
		panic(err)
	}

	sim := simulator.New(num, 10, r, nats.MessageBus, fakeCC)
	//start all the HM components (make them pipe to stdout)
	start("listen", false)
	start("fetch_desired", true)
	start("analyze", true)
	start("send", true)
	start("serve_metrics", false)
	start("serve_api", false)
	time.Sleep(time.Second)
	go Tick(sim)
	go Fetch()
	select {}
}
コード例 #2
0
func (coordinator *MCATCoordinator) StartNats() {
	coordinator.natsRunner = natsrunner.NewNATSRunner(coordinator.NatsPort)
	coordinator.natsRunner.Start()
	coordinator.MessageBus = coordinator.natsRunner.MessageBus
}