0

我一直在尝试让 Scala Protobuf 消息与 Akka protobuf 序列化程序一起使用,但是当我通过远程处理发送消息时,我不断收到此响应

Using the default Java serializer for class [au.com.bluereef.sonar.gui.protocol.auth.AuthenticationResponse] which is not recommended because of performance implications. Use another serializer or disable this warning using the setting 'akka.actor.warn-about-java-serializer-usage'

在应用程序配置中,我有这个设置

akka {
  log-dead-letters = off 
  log-dead-letters-during-shutdown = off 

  actor {
    provider = "akka.remote.RemoteActorRefProvider"

    serializers {
      java = "akka.serialization.JavaSerializer"
      proto = "akka.remote.serialization.ProtobufSerializer"
    }   

    serialization-bindings {
      "java.lang.String" = java
      "com.google.protobuf.Message" = proto
    }   
  }

  remote {
    enabled-transports = ["akka.remote.netty.tcp"]

    netty.tcp {
      hostname = "127.0.0.1"
      port = 8123
    }   
  }
}

这些消息在一个单独的项目中编译,其中包含 proto 文件,src/main/protobuf并使用 sbt 和 ScalaPB ( "com.trueaccord.scalapb" % "sbt-scalapb" % "0.4.20") 插件进行编译。

import com.trueaccord.scalapb.{ScalaPbPlugin => PB} 

name := "protocol"

version := Process("git describe --tags --abbrev=5", baseDirectory.value).!!.replace("\n", "") 

organization := "au.com.bluereef.sonar.gui"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
        "com.typesafe.slick" %% "slick" % "3.1.1",
        "org.postgresql" %  "postgresql" % "9.4.1208"
)

PB.protobufSettings

PB.javaConversions in PB.protobufConfig := true

PB.runProtoc in PB.protobufConfig := (args =>
  com.github.os72.protocjar.Protoc.runProtoc("-v300" +: args.toArray))

有什么线索吗?

4

1 回答 1

1

使用 scalapb 生成的消息不扩展com.google.protobuf.Message,请尝试使用com.trueaccord.scalapb.GeneratedMessage

于 2016-04-18T18:00:56.257 回答