News for hackers. Stuff that matters.
Re:Why We’re Switching to gRPC by rubenbe on Monday May 27, 2019 @01:28PM (#20023778)
I recently chose gRPC as a communication protocol between two devices (sort of IoT).

Until now it works perfectly as expected. The C++ code generator provides a clean abstraction plus it saved a lot of time (both in programming and debugging). The gRPC proto file syntax also nudge you in the right direction wrt protocol design.

When trying to "sell" gRPC it helps that there are generators for plenty of languages and it's backed by a major company.

Re:Why We’re Switching to gRPC by gravypod on Monday May 27, 2019 @01:33PM (#20023823)
I wish that tooling around generating protoc into stubs and client libraries was simpler. I wish there was a single command I could run and turn large collection of proto files into libraries for "all" languages (python, java, C++, Node package, etc). Unfortunately there's no universal approach to this.
Re:Why We’re Switching to gRPC by q3k on Tuesday May 28, 2019 @07:51AM (#20029150)
This seems like an odd requirement. Are you trying to generate stubs for your API users ahead of time? This will likely not work as generated stubs evolve in lockstep with protoc and runtime support libraries, and thus are not guaranteed to work across discrepant versions. Thus, stub code should be generated alongside the consumer/client. It also likely shouldn't be committed into a VCS.
Re:Why We’re Switching to gRPC by gravypod on Tuesday May 28, 2019 @08:15AM (#20029280)
It would be done in CI. Generate stubs -> package/compile -> push to internal package repo.

This way your protocol for your infrastructure is just another library.

Re:Why We’re Switching to gRPC by q3k on Tuesday May 28, 2019 @09:33AM (#20029819)
Having an explicit 'create client library by generating/compiling proto stubs' is generally also bad mojo from my experience, unless you're also abstracting API stability and service discovery. If not, it will be unnecessarily painful to make a change to either the service discovery method or a non-backwards-compatible proto change, as you will have to lockstep both the service rollout, the library build and the client bump.
Re:Why We’re Switching to gRPC by jsty on Monday May 27, 2019 @01:41PM (#20023884)
What makes that impossible now? I'm probably overlooking something in your use case, but couldn't you just have a simple build script / makefile that generated the libraries with a different protoc call for each library?
Re:Why We’re Switching to gRPC by gravypod on Monday May 27, 2019 @02:43PM (#20024331)
Nothing makes it impossible but comparing it to things like thrift the complexity becomes apparent:

    thrift --gen <language> <Thrift filename>
This handles the following languages: C (depends on GLib), Cocoa, C++, C#, D, delphi, Erlang, Go, Haskell, Java, Javascript, OCaml, Perl, PHP, Python, Ruby, Smalltalk. From this one command I can instantly integrate this into almost every build system I know of.

On the other hand gRPC has the same features but it's a slightly different workflow. For each language you go to the language's code generation page, find the command line option for generating your language's code, read up on some decisions that were made for you, etc. All of that is fine, the part that annoys me a bit is each language needs a language module for the compiler (if it's not one of the core few languages). For example in the documentation for generating Go [1] they have you download and install protoc-gen-go from http://github.com/golang/protobuf assuming that you already have golang installed.

gRPC seems much more focused on the idea that I want to define an API for my code, I want that specification to live inside the project that I am writing, and that you can figure out how to generate stubs on a language by language basis.

What I want is something I can write a set of system specification files, type one command and get modules built for all languages. From there I can import those modules using my native language's favorite package manager (npm, composer, Hunter for CMake, etc). Ideally the Protocol Specification, the Library Generation, and the Library Usage are three components that are separate.

[1] - https://developers.google.com/protocol-buffers/docs/referenc...

Re:Why We’re Switching to gRPC by jsty on Monday May 27, 2019 @03:19PM (#20024606)
With the significant caveat that I haven't used it much myself (I mainly work with Bazel which obviates the need), I think Uber's prototool [0] can manage most if not all of that. Might be worth giving it a look.

[0] https://github.com/uber/prototool

Re:Why We’re Switching to gRPC by shereadsthenews on Monday May 27, 2019 @01:37PM (#20023855)
bzl build :my_proto_library ?
Re:Why We’re Switching to gRPC by gravypod on Monday May 27, 2019 @02:21PM (#20024182)
In many conversations I've had with Google (or Google-Adjacent) engineers I've revealed a truth to them that was quite shocking: Bazel isn't the only build system in wide scale deployment currently. It's also far from the most used build system currently. While Bazel is a monolithic tool that solves this problem there is no external tool that solves this problem of configuring the different semantics and configuration for protos in different languages.
Re:Why We’re Switching to gRPC by shereadsthenews on Monday May 27, 2019 @02:33PM (#20024268)
You said you wished for a command and I gave you one.