简体   繁体   English

Vertx | 为什么代理服务或事件总线服务不适用于Future?

[英]Vertx | Why proxy service or event bus service does not work with Future?

Why is that the development of proxy service or event bus service works only with Async Handler and not with Future. 为什么代理服务或事件总线服务的开发仅适用于Async Handler,而不适用于Future。 If I pass Future to one of the methods of a Service Interface/Implementation and if I do a future.completer , it eventually returns Handler<AsyncResult<T>> and so does the service methods requires as a parameter (Handler<AsyncResult<T>>) . 如果我将Future传递给服务接口/实现的一个方法,如果我做了future.completer ,它最终会返回Handler<AsyncResult<T>> ,因此服务方法需要作为参数(Handler<AsyncResult<T>>)

This is the error I get while building my application: 这是我在构建应用程序时遇到的错误:

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 无法为addAccount生成模型(Account,io.vertx.core.Future):类型io.vertx.core.Future对于代理中的参数使用是不合法的io.vertx.codegen.GenException:输入io.vertx.core .Fure对于代理中的参数使用是不合法的

There are restrictions on the types you can use when you define your service proxy interface. 定义服务代理接口时可以使用的类型有限制。 They are listed in the Restrictions for service interface of the documentation. 它们列在文档的服务界面限制中 In particular: 尤其是:

If an asynchronous result is required a last parameter of type Handler<AsyncResult<R>> can be provided. 如果需要异步结果,则可以提供Handler<AsyncResult<R>>类型的最后一个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM