0

J'ai essayé d'obtenir Scala messages Protobuf travaillant avec le Akka protobuf sérialiseur mais je continue à obtenir cette réponse quand j'envoie les messages via RemotingScala messages protobuffer utilisant mal sérialiseur avec Akka Remoting

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' 

Dans l'application config J'ai cette configuration

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 
    } 
    } 
} 

les messages sont compilés dans un projet distinct avec les fichiers proto sous src/main/protobuf et sont compilés avec SBT et le plug-in 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)) 

Des indices?

Répondre

1

Les messages générés avec scalapb ne s'étendent pas com.google.protobuf.Message, essayez plutôt d'utiliser com.trueaccord.scalapb.GeneratedMessage.

+0

Si simple pourtant j'ai complètement raté cela. Merci beaucoup pour votre aide! –