Пример #1
0
func main() {
	flag.Parse()
	portOffset := *gostrich.PortOffset
	newBinding := gostrich.UpdatePort(*binding, portOffset)

	conf := rpcx.ReliableServiceConf{
		Name:        "tweetbutton",
		Makers:      makeAll(*cassandras, *cassandraTimeout),
		Retries:     *retries,
		Concurrency: *concurrency,
		Stats:       gostrich.AdminServer().GetStats().Scoped("tbapi"),
		Prober:      rpcx.ProberReqLastFail,
	}
	cas := rpcx.NewReliableService(conf)

	state := ServerState{cas}

	server := http.Server{
		newBinding,
		&state,
		*readTimeout,
		*writeTimeout,
		0,
		nil,
	}
	logger.LogInfo("Tweetbutton starting up...\n")
	go func() {
		logger.LogInfo(server.ListenAndServe())
	}()

	gostrich.StartToLive(nil)
}
Пример #2
0
func main() {
	flag.Parse()
	portOffset := *gostrich.PortOffset

	log.Printf("Starting TFE with rule: %v, read timeout: %v, write timeout: %v, with port_offset: %v",
		*conf, *readTimeout, *writeTimeout, portOffset)
	theTfe := &tfe.Tfe{tfe.GetRules(*conf, portOffset)()}
	for binding, rules := range theTfe.BindingToRules {
		server := http.Server{
			binding,
			&rules,
			*readTimeout,
			*writeTimeout,
			0,
			nil, // SSL TODO
		}
		go server.ListenAndServe()
	}
	gostrich.StartToLive(nil)
}