(Nodejs) Calling grpc.load() multiple times supported?

308 views
Skip to first unread message

Rob Cecil

unread,
Jun 8, 2016, 10:53:42 AM6/8/16
to grpc.io
All the examples use a single .proto, a single grpc.load(PROTO_PATH)... statement.

Is this sort of thing supported?

var PROTO1_PATH = __dirname + '/service1.proto';

var PROTO2_PATH = __dirname + '/service2.proto';

...

var package1 = grpc.load(PROTO1_PATH).package1;
var package2 = grpc.load(PROTO2_PATH).package2;

If not, then is the solution to basically merge all services into one mega proto that uses import statements?

Thanks!

Rob Cecil

unread,
Jun 8, 2016, 10:55:57 AM6/8/16
to grpc.io
The use case, is suppose you want to write the implementation of service1.proto (new grpc.Server()... addProtoService(pacakge1.SomeService.service...), but also create client from service2.proto that the first server calls into.

Michael Lumish

unread,
Jun 13, 2016, 1:02:04 PM6/13/16
to Rob Cecil, grpc.io
Yes, you can load multiple proto files without any problems. grpc.load has no noticeable side effects, so there should be no problem with running it multiple times.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/a53d648b-4a53-4ad5-b6ce-650c8cf9e648%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages