Scala protobuffer 消息使用错误的序列化程序与 Akka Remoting

Scala protobuffer messages using wrong serializer with Akka Remoting

我一直在尝试让 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
    }   
  }
}

消息在单独的项目中编译,原始文件位于 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))

有什么线索吗?

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