【发布时间】:2018-09-09 01:51:49
【问题描述】:
我正在尝试开发数据库服务代理并使用扩展 io.vertx.reactivex.core.AbstractVerticle 的 Verticle,以便我可以在数据库调用周围使用 rxJava 语义。问题是,当我编码生成服务代理时,我得到了这个:
ServiceVertxEBProxy.java:[37,1] a type with the same simple name is already defined by the single-type-import of io.vertx.core.Vertx
数据库服务负责处理共享的dbclient,我是通过:
public Single<SQLConnection> getConnection()
{
JDBCClient dbClient = JDBCClient.createShared( vertx, CONFIG, DATASOURCE );
return dbClient.rxGetConnection().flatMap( conn -> {
Single<SQLConnection> connectionSingle = Single.just( conn );
return connectionSingle.doFinally( conn::close );
} );
}
是否可以使用@ProxyGen 在服务中创建引用 rxJava 的代理客户端?
作为参考,接口声明了工厂方法来实例化服务,遵循 vertx.io 文档。
import io.vertx.reactivex.core.Vertx;
@ProxyGen
public interface ChatDbService
{
static ChatDbService create( Vertx vertx )
{
return new ChatDbServiceImpl( vertx );
}
static ChatDbService createProxy( Vertx vertx, String address )
{
return new ChatDbServiceVertxEBProxy( vertx.getDelegate(), address );
}
}
我们将不胜感激。
【问题讨论】:
标签: rx-java vert.x vertx-verticle