Replace Java serialization of DaemonMsg by protobuf. See #1755
* Serializers for DaemonMsgCreate and DaemonMsgWatch * Protobuf for DaemonMsgCreateProtocol, PropsProtocol, DeployProtocol, DaemonMsgWatchProtocol * Removed unused MailboxProtocol.proto * Fixed wrong serializeActorRef in DurableMessageSerialization
This commit is contained in:
parent
2e248e4b49
commit
6dd017d6c1
10 changed files with 2724 additions and 296 deletions
|
|
@ -6,6 +6,22 @@ package akka.serialization
|
|||
|
||||
import com.google.protobuf.Message
|
||||
import akka.actor.DynamicAccess
|
||||
import akka.remote.RemoteProtocol.ActorRefProtocol
|
||||
import akka.actor.ActorSystem
|
||||
import akka.actor.ActorRef
|
||||
|
||||
object ProtobufSerializer {
|
||||
def serializeActorRef(ref: ActorRef): ActorRefProtocol = {
|
||||
val identifier: String = Serialization.currentTransportAddress.value match {
|
||||
case null ⇒ ref.path.toString
|
||||
case address ⇒ ref.path.toStringWithAddress(address)
|
||||
}
|
||||
ActorRefProtocol.newBuilder.setPath(identifier).build
|
||||
}
|
||||
|
||||
def deserializeActorRef(system: ActorSystem, refProtocol: ActorRefProtocol): ActorRef =
|
||||
system.actorFor(refProtocol.getPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* This Serializer serializes `com.google.protobuf.Message`s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue