我正在尝试从https://vertx.io/docs/vertx-core/scala/#_the_event_bus_api复制代码,但出现编译错误。
override def start(): Unit = {
vertx.eventBus.sendFuture("anAddress", "message 1").onComplete {
case Success(result) => {
println("The handler un-registration has reached all nodes")
}
case Failure(cause) => {
println(s"$cause")
}
}
}
我收到此错误:
missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: scala.util.Try[io.vertx.scala.core.eventbus.Message[?]] => ?
vertx.eventBus.sendFuture("anAddress", "message 1").onComplete {
^
我该如何解决这个问题?
我正在使用 Scala 2.12.8 和 Vert.x 3.7.1
我环顾四周,但没有成功。
感谢提前!