You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
object Engine {
implicit val timeout = Timeout(1 second)
val ngin = Akka.system.actorOf(Props[Engine])
}
class Engine extends Actor {
val ser = SerializationExtension(context.system)
override def preStart() = {
println("Got %s serializer for %s"
.format(ser.findSerializerFor(classOf[java.lang.String]).getClass().getName(),
classOf[java.lang.String].getName()))
}
def receive = { ... }
}
While my application.conf file contains the following section:
play { akka { actor {
serializers { proto = "akka.serialization.ProtobufSerializer" }
serialization-bindings { "java.io.Serializable" = proto
"java.lang.String" = proto }
} } }
Though I always get JavaSerializer: "Got
akka.serialization.JavaSerializer serializer for java.lang.String"
What am I doing wrong?!
-Matthew
The text was updated successfully, but these errors were encountered:
"java.io.Serializable" = proto doesn't look right, it should be =${proto} with the ${} maybe?
You might try setting some other random thing in the config file (just make up a setting) that doesn't involve the SerializationExtension stuff, and be sure play.akka is even used. For example set play.akka.hello="Hi", then print context.system.settings.config.getString("akka.hello")
This is kind of weird, I would expect that the play{} should be there. hard to debug without a full test case though.
I'm going to close the issue here because I don't think there's an action to take in the config lib code/docs (?) but it might be worth asking the Play guys what is going on, though sending them a small test app might be needed. Thanks
Hi guys,
I'd like to configure protobuf to be the default serialization for my messages.
Here what I do in attempt to make it happen:
import akka.actor._
import akka.pattern.ask
import akka.serialization._
import akka.util._
import play.api._
import play.libs.Akka
import akka.util.Timeout
object Engine {
implicit val timeout = Timeout(1 second)
val ngin = Akka.system.actorOf(Props[Engine])
}
class Engine extends Actor {
val ser = SerializationExtension(context.system)
override def preStart() = {
println("Got %s serializer for %s"
.format(ser.findSerializerFor(classOf[java.lang.String]).getClass().getName(),
classOf[java.lang.String].getName()))
}
def receive = { ... }
}
While my application.conf file contains the following section:
play { akka { actor {
serializers { proto = "akka.serialization.ProtobufSerializer" }
serialization-bindings { "java.io.Serializable" = proto
"java.lang.String" = proto }
} } }
Though I always get JavaSerializer: "Got
akka.serialization.JavaSerializer serializer for java.lang.String"
What am I doing wrong?!
-Matthew
The text was updated successfully, but these errors were encountered: