Giter Site home page Giter Site logo

grpc-production-java's Introduction

gRPC for production

This project abstracts away the details of the gRPC server and client configuration.

Here are the main features:

  • Health check service — We use the grpc_health_probe utility which allows you to query health of gRPC services that expose service their status through the gRPC Health Checking Protocol.
  • Shutdown hook — The library registers a shutdown hook with the gRPC server to ensure that the application is closed gracefully on exit
  • Keep alive params — Keepalives are an optional feature but it can be handy to signal how the persistence of the open connection should be kept for further messages
  • Custom Server builder with some opinionated production ready settings
  • Added ability to recover the system from a Runtime exception in the request
  • Added ability to add multiple ordered interceptors
  • Handy Server interceptors(Authentication, request cancelled, Audit request/response...)
  • Handy Client interceptors(Timeout logs, Audit request, Default timeout...)

Examples

   List<BindableService> services = new ArrayList<>();
   List<ServerInterceptor> interceptors = Factory.allDefaultInterceptors();
   GrpcServerBuilder builder = GrpcServerBuilder.port(50052);
   GrpcServer grpcServer = builder
           .withServices(services)
           .withInterceptors(interceptors)
           .withFixedThreadPool(4)
           .withMaxConnectionAge(5, TimeUnit.MINUTES)
           .withReflectionEnabled(true)
           .withHealthCheck()
           .build();
   grpcServer.start();

Please leave a star if this project helped you!

grpc-production-java's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.