java - 顶点|为什么代理服务或事件总线服务不能与 Future 一起使用?

标签 java vert.x

为什么代理服务或者事件总线服务的开发只能使用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/

相关文章:

java - 在 vert.x 上使用事件总线注册编解码器

java - vert.x - 可能有多少个计时器

java - Jboss-CLI 无法从远程连接

Java 相当于 Python 的 webbrowser.open()

带有 SSL 和 Postman 的 java.nio.channels.ClosedChannelException

java - 访问匿名处理函数内部的对象

javabeans - 两台机器 JVM 之间带有 Ignite 集群的集群 vertx 事件总线

java - 在控制台上显示数据并将数据保存到文本文件。

java - 嵌套的 JSONObject

java - Android NDK 写入 SQLite