polyglot
polyglot copied to clipboard
Using polyglot as a library
I would like to use polyglot as a library e.g. ideally pulling in a dependency from central that has all the transitive dependencies declared in a pom.xml.
Currently, I am using a local repo with a modified release JAR with the JVM dependencies ripped out and a manually crafted pom.xml used to pull in the JVM dependencies but this is not ideal.
What is the current suggested approach for this use case? Or is polyglot only intended to be used as a standalone binary?
Thanks!
This is definitely as use case that has been considered, but that I haven't really gotten to addressing yet. We would have to figure out how to generate pom files, publish them, and somehow test the library setup.
Just to make sure I understand you use case: would you be interested in the entire ServiceCall as a library, or just some individual parts (like the DynamicGrpcClient)?
I am currently still exploring which bits would be useful to me as a library.
The general problem I am solving is communication with servers when I only know the proto files at runtime or via server reflection, which led me to this project.
I think what I need boils down to:
- Read one or more
DynamicMessagegiven someInputStream - Send the messages using
DynamicGrpcClient
Just wanted to chime in with another use-case we have where it would be helpful to use this repo as a library. We're starting to deploy grpc services and want to have a centralized json gateway that can list all of the various methods available, describe their input/output types, and accept JSON requests over HTTP/1.1 and proxy to the grpc backends. The gateway could use polyglot as a library (integrated with our service discovery) to introspect services/methods each time a grpc app is deployed, and also use the DynamicGrpcClient to proxy JSON requests.
@jhaber interesting, I have heard about this potential use case a few times. One idea I was toying with was to add a "--server" mode to polyglot, causing it to run as a server and serve a web page which does roughly what you are describing.