Provide a way to create non-official gRPC client stub
See original GitHub issueCurrently, Armeria gRPC client factory use reflections to find a stub factory method or constructor from the specified client type. Armeria supports well-known client types already such as gRPC-Java, Reactive-gRPC, gRPC-Kotlin, and so on.
When users want to use a new gRPC client stub with Armeria gRPC client, we need to add a new reflection code to find ServiceDescriptor and a stub factory. I think this is not scalable.
If we introduce a GrpcStubFactory, users can easily integrate their gRPC stub with Armeria.
interface GrpcStubFactory {
// Should return a ServiceDescriptor to use gRPC JSON foramt
@Nullable
ServiceDescriptor serviceDescriptor();
Object stub(Channel channel);
}
MyGrpcStub client =
Clients.builder(grpcUrl)
.options(GrpcClientOptions.STUB_FACTORY.newValue(new GrpcStubFactory {
@Override
public ServiceDescriptor serviceDescriptor() {
return MyGrpcStub.SERVICE;
}
@Override
public Object stub(Channel channel) {
return MyGrpcStub.stub(channel);
}
})
.build(MyGrpcStub.class);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Basics tutorial | Java - gRPC
This tutorial provides a basic Java programmer's introduction to working with gRPC. By walking through this example you'll learn how to:.
Read more >Basics tutorial | Go - gRPC
This tutorial provides a basic Go programmer's introduction to working with gRPC. ... Generate server and client code using the protocol buffer compiler....
Read more >Basics tutorial | Python - gRPC
This tutorial provides a basic Python programmer's introduction to working with gRPC. By walking through this example you'll learn how to:.
Read more >So You Want to Optimize gRPC - Part 1
A common question with gRPC is how to make it fast. The gRPC library offers users ... We refer to the code called...
Read more >Basics tutorial | C++ - gRPC
proto file and generate clients and servers in any of gRPC's supported languages, which in turn can be run in environments ranging from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think that’s fine.
A generic type parameter could not be properly handled by SPI. In the following code, the
IOtype could be changed to other types by users’ choice.Does it look weird if we support both SPI and
GrpcClientOptions.CLIENT_STUB_FACTORY? gRPC-Java, gRPC-Kotlin, Reactive gRPC, and ScalaPB can be provided by SPI.