// RunGRPCServer runs gRPC service on the given port.
RunGRPCServer runs gRPC service on the given port.
// RunGRPCServer runs gRPC service on the given port .
func RunGRPCServer(lc fx.Lifecycle, server *grpc.Server, listener net.Listener) error {
	lc.Append(
		fx.Hook{
			OnStart: func(ctx context.Context) error {
				reflection.Register(server)
				grpc_prometheus.EnableHandlingTimeHistogram()
				grpc_prometheus.Register(server)
				http.Handle("/metrics", promhttp.Handler())
				logger.Log.Info("Prom metrics endpoint registered on /metrics")
				logger.Log.Info("Starting HTTP2/gRPC server...")
				go server.Serve(listener)
				return nil
			},
			OnStop: func(ctx context.Context) error {
				logger.Log.Info("Stopping  gRPC server...")
				server.GracefulStop()
				return nil
			},
		},
	)
	return nil
}
func RunGRPCServer ( lc fx . Lifecycle , server * grpc . Server , listener net . Listener ) error { lc . Append ( fx . Hook { OnStart : func ( ctx context . Context ) error { reflection . Register ( server ) grpc_prometheus . EnableHandlingTimeHistogram ( ) grpc_prometheus . Register ( server ) http . Handle ( " " , promhttp . Handler ( ) ) logger . Log . Info ( " " ) logger . Log . Info ( " " ) go server . Serve ( listener ) return nil } , OnStop : func ( ctx context . Context ) error { logger . Log . Info ( " " ) server . GracefulStop ( ) return nil } , } , ) return nil }
RunGRPCServer runs gRPC service on the given port.
RunGRPCServer runs gRPC service on the given port .
// start gRPC server // start gRPC server