Luca Bonamini
Luca Bonamini

Reputation: 11

Construct a server object using grpc core libraries directly

I want to implement a template class to wrap gRPC Server and Client, so that I can have a base interface for all services and clients of a project.

Is there a way to do that using gRPC core libraries? I searched through the documentation but I couldn't find anything related to this topic.

Upvotes: 1

Views: 318

Answers (1)

user4442671
user4442671

Reputation:

To answer the question as asked:

The various gRPC sdks are all built on top of the core libraries, so it's entirely possible. Everything you need can be found in the grpc/grpc.h header

A simple-ish way to start going down that road would be to set the following environment variables, and run a gRPC app that behaves the way you want your custom server/client to.

GRPC_VERBOSITY=DEBUG
GRPC_TRACE=api

This will show you the sequence of core api calls that are being made, which you can use as a reference.

You can find more details here: https://github.com/grpc/grpc/blob/master/doc/environment_variables.md

That being said...

so that I can have a base interface for all services and clients of a project.

That's not particularly hard to do with the C++ sdk either, and that would be a LOT less work than working with the core library.

Upvotes: 1

Related Questions