Exemplo n.º 1
0
func init() {
	b, e := json.Marshal(make(map[string]string))

	if e != nil {
		logging.Fatalf("Error setting up empty JSON response! %+v", e)
	}

	emptyJsonResponse = b
}
Exemplo n.º 2
0
func NewRedisStatsListener(redisOpts *redis.Options) *redisListener {
	client := redis.NewClient(redisOpts)
	_, err := client.Ping().Result()

	if err != nil {
		logging.Fatalf("RedisStatsListener: cannot connect to Redis, %v", err)
	}

	return &redisListener{client}
}
Exemplo n.º 3
0
func (g *GrpcEndpoint) Start() {
	lis, err := net.Listen("tcp", g.hostport)
	if err != nil {
		logging.Fatalf("Cannot start server on port %v. Error %v", g.hostport, err)
		panic(fmt.Sprintf("Cannot start server on port %v. Error %v", g.hostport, err))
	}

	grpclog.SetLogger(logging.CurrentLogger())
	g.grpcServer = grpc.NewServer()
	// Each service should be registered
	pb.RegisterQuotaServiceServer(g.grpcServer, g)
	go g.grpcServer.Serve(lis)
	g.currentStatus = lifecycle.Started
	logging.Printf("Starting server on %v", g.hostport)
	logging.Printf("Server status: %v", g.currentStatus)
}