Exemple #1
0
func main() {
	logger = cocaine.NewLogger()
	binds := map[string]cocaine.EventHandler{
		"get": get,
	}
	Worker := cocaine.NewWorker()
	Worker.Loop(binds)
}
Exemple #2
0
func main() {
	binds := map[string]cocaine.EventHandler{
		"parsing":   parsing,
		"aggregate": aggregate,
		"common":    common,
	}
	Worker := cocaine.NewWorker()
	Worker.Loop(binds)
}
Exemple #3
0
func main() {
	runtime.GOMAXPROCS(2)
	binds := map[string]cocaine.EventHandler{
		"send": Send,
	}
	Worker, err := cocaine.NewWorker()
	if err != nil {
		log.Fatal(err)
	}
	Worker.Loop(binds)
}
Exemple #4
0
func main() {
	logger = cocaine.NewLogger()
	storage, _ = cocaine.NewStorage("localhost", 10053)
	binds := map[string]cocaine.EventHandler{
		"testevent": dummy,
		"echo":      echo,
		"test":      app_list,
		"http":      http_test}
	Worker := cocaine.NewWorker()
	Worker.Loop(binds)
}
Exemple #5
0
func main() {
	var err error
	logger, err = cocaine.NewLogger()
	binds := map[string]cocaine.EventHandler{
		"send": Send,
	}
	Worker, err := cocaine.NewWorker()
	if err != nil {
		log.Fatal(err)
	}
	Worker.Loop(binds)
}
Exemple #6
0
func main() {
	binds := map[string]cocaine.EventHandler{
		"generate":      on_generate,
		"generate-http": on_http_generate,
	}

	Worker, err := cocaine.NewWorker()
	if err != nil {
		panic(err)
	}

	storage, err = cocaine.NewService("storage")
	if err != nil {
		panic(err)
	}

	Worker.Loop(binds)
}
Exemple #7
0
func main() {
	runtime.GOMAXPROCS(10)
	var err error
	logger, err = cocaine.NewLogger()
	binds := map[string]cocaine.EventHandler{
		"handleTask": handleTask,
	}

	ctxParsing = &parsing.ParsingContext{
		Ctx:      context.Background(),
		Resolver: slave.NewLocalResolver(),
	}

	Worker, err := cocaine.NewWorker()
	if err != nil {
		log.Fatal(err)
	}
	Worker.Loop(binds)
}
Exemple #8
0
func main() {
	fetcher := gofetcher.NewGofetcher()
	if fetcher != nil {
		binds := map[string]cocaine.EventHandler{
			"get":    fetcher.GetHandler("GET"),
			"head":   fetcher.GetHandler("HEAD"),
			"post":   fetcher.GetHandler("POST"),
			"put":    fetcher.GetHandler("PUT"),
			"patch":  fetcher.GetHandler("PATCH"),
			"delete": fetcher.GetHandler("DELETE"),
		}

		if worker, err := cocaine.NewWorker(); err == nil {
			worker.Loop(binds)
		} else {
			panic(err)
		}
	}
}