How to share Protobuf definitions for gRPC?

Unfortunately, there is no common practice, although the main goal that you should achieve is to store proto files in one version control repository. During my investigation, I’ve found some interesting blog posts about that subject: https://www.bugsnag.com/blog/libraries-for-grpc-services https://www.crowdstrike.com/blog/improving-performance-and-reliability-of-microservices-communication-with-grpc/ https://medium.com/namely-labs/how-we-build-grpc-services-at-namely-52a3ae9e7c35 They covers much of gRPC workflow considerations. Hope that helps!

How are protocol-buffers faster than XML and JSON?

String representations of data: require text encode/decode (which can be cheap, but is still an extra step) requires complex parse code, especially if there are human-friendly rules like “must allow whitespace” usually involves more bandwidth – so more actual payload to churn – due to embedding of things like names, and (again) having to deal … Read more

golang protobuf remove omitempty tag from generated json tags

If you are using grpc-gateway and you need the default values to be present during json marshaling, you may consider to add the following option when creating your servemux gwmux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true})) Outside of grpc-gateway, if you want to marshal your protocol buffer message, use google.golang.org/protobuf/encoding/protojson (*) package instead of encoding/json … Read more

How to debug grpc call?

You can set the GRPC_TRACE environment variable to all to have grpc dump a whole bunch of data about what the connection is doing: export GRPC_TRACE=all edit from comment: apparently you also need to set: export GRPC_VERBOSITY=DEBUG

Pattern for rich error handling in gRPC

Include additional error details in the response Metadata. However, still make sure to provide a useful status code and message. In this case, you can add RegisterUserResponse to the Metadata. In gRPC Java, that would look like: Metadata.Key<RegisterUserResponse> REGISTER_USER_RESPONSE_KEY = ProtoUtils.keyForProto(RegisterUserResponse.getDefaultInstance()); … Metadata metadata = new Metadata(); metadata.put(REGISTER_USER_RESPONSE_KEY, registerUserResponse); responseObserver.onError( Status.INVALID_ARGUMENT.withDescription(“Email or password malformed”) .asRuntimeException(metadata)); … Read more

REST vs gRPC: when should I choose one over the other?

When done correctly, REST improves long-term evolvability and scalability at the cost of performance and added complexity. REST is ideal for services that must be developed and maintained independently, like the Web itself. Client and server can be loosely coupled and change without breaking each other. RPC services can be simpler and perform better, at … Read more

Using Spring Boot together with gRPC and Protobuf

If it’s still relevant for you, I’ve created gRPC spring-boot-starter here. grpc-spring-boot-starter auto-configures and runs the embedded gRPC server with @GRpcService-enabled beans. The simplest example : @GRpcService(grpcServiceOuterClass = GreeterGrpc.class) public static class GreeterService implements GreeterGrpc.Greeter { @Override public void sayHello(GreeterOuterClass.HelloRequest request, StreamObserver<GreeterOuterClass.HelloReply> responseObserver) { // omitted } } There is also an example of how … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)