vert-x3 / vertx-service-proxy

EventBus Proxy generation
Apache License 2.0
67 stars 58 forks source link

Supporting Future<T> methods #107

Closed mystdeim closed 3 years ago

mystdeim commented 5 years ago

It will be good to support Future style actions:

@ProxyGen
public interface SomeService {
    Future<T> action()
}
slinkydeveloper commented 4 years ago

We reverted the #109 because it had a fundamental problem of interop between this codegen and the other codegens of vertx stack.

The lang code generators (kotlin, rxjava, ...) assumes that, if a method has a callback with Handler<AsyncResult<T>>, then that method is an "async method". All methods in the vertx 4 APIs now have been futurized, so for each void foo(Handler<AsyncResult<T>>) exists an alternative Future<T> foo(), but lang generators just ignore these "futurized methods". Which means that rx-java code generator will always use the callback method to generate a Single<T>.

This leads to the fundamental problem of #109: It was exploiting (probably) a missing check on vertx-codegen that allowed to have the future method but not the callback method, and this led to have a service proxy interface which is not a valid @VertxGen interface that other code generators cannot understand.

Which means we have to find another solution to such problem.

A proposal I wish to put on the table: We let the user develop only with futures (maybe we need another annotation as entrypoint for this feature) and we generate the base interface @VertxGen-compatible with default implementation of callback methods. Then

slinkydeveloper commented 4 years ago

Update: https://github.com/vert-x3/vertx-codegen/issues/317