Grpc-java: CompletableFuture stubs

Created on 7 Mar 2017  路  3Comments  路  Source: grpc/grpc-java

Hello,
I'd like to start a discussion about adding a CompletableFuture-based stub implementations to gRPC. I understand that generated gRPC code must be backwards compatible with Java 6, so here are some alternative implementation strategies to consider.

  1. Implement CompletableFuture-based stubs in a stand-alone class generated by a stand-alone protoc plugin. The CF stub class would reference the public MethodDescriptors of the stock generated client. This option is easiest to implement, but presents a fragmented programming model.
  2. Implement CompletableFuture-based stubs inline with the existing generated stubs by adding @@protoc_insertion_points to the stock c++ generator. A protoc plugin would be used to populate the insertion points. This option has the benefit of presenting a homogenous programming model for this, and all future plugin-based stub extensions, but requires a coordinated one time change with the protoc project.
  3. Extend the c++ generator with optional support for CompletableFuture. Use a protoc flag to turn it on and off. Not a great option, but possible.
enhancement

Most helpful comment

I get the impression from #2688 that Guava upgrades are problematic. Would Guava vNext introduce the same compatibility break that Guava 20 introduced?

All 3 comments

Guava might have to face this sooner than we do, so they may make their futures Completable anyways, and you could just cast. gRPC could just ride this out.

I get the impression from #2688 that Guava upgrades are problematic. Would Guava vNext introduce the same compatibility break that Guava 20 introduced?

I just saw that Guava recommends future-converter.

Was this page helpful?
0 / 5 - 0 ratings