2017-07-04 136 views
0

我尝试创建gRPC客户端。对于无法使用scala构建gRPC ManagedChannel

val channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext(true).build 

我得到这个编译时错误

Error:(18, 87) value build is not a member of ?0 
    val channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext(true).build 

GRPC是专门为Java构建。我的项目是多模块maven项目,其中protobuf文件和生成的代码位于单独的模块中。

回答

0

我设法通过增加冗余铸造来解决这个问题

val channel = ManagedChannelBuilder 
    .forAddress(host, port) 
    .usePlaintext(true) 
    .asInstanceOf[ManagedChannelBuilder[_]].build