为什么代理服务或者事件总线服务的开发只能使用Async Handler,而不能使用Future。如果我将 Future 传递给服务接口(interface)/实现的方法之一,并且如果我执行 future.completer
,它最终返回 Handler<AsyncResult<T>>
服务方法也需要参数 (Handler<AsyncResult<T>>)
。
这是我在构建应用程序时遇到的错误:
Could not generate model for addAccount(Account,io.vertx.core.Future): type io.vertx.core.Future is not legal for use for a parameter in proxy io.vertx.codegen.GenException: type io.vertx.core.Future is not legal for use for a parameter in proxy
最佳答案
定义服务代理接口(interface)时可以使用的类型受到限制。它们列在 Restrictions for service interface 中的文档。特别是:
If an asynchronous result is required a last parameter of type
Handler<AsyncResult<R>>
can be provided.
关于java - 顶点|为什么代理服务或事件总线服务不能与 Future 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42368442/