forked from akka/akka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request akka#1757 from eligosource/wip-3652-custom-seriali…
…zation-krasserm !per #3652 Custom snapshot and persistent message serialization
- Loading branch information
Showing
35 changed files
with
4,045 additions
and
386 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
akka-docs/rst/java/code/docs/persistence/PersistenceDocTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
akka-docs/rst/scala/code/docs/persistence/PersistenceDocSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
akka-docs/rst/scala/code/docs/persistence/PersistencePluginDocSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
akka-docs/rst/scala/code/docs/persistence/PersistenceSerializerDocSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> | ||
*/ | ||
|
||
package docs.persistence | ||
|
||
import com.typesafe.config._ | ||
|
||
import org.scalatest.WordSpec | ||
|
||
import akka.actor.ActorSystem | ||
import akka.serialization.{ Serializer, SerializationExtension } | ||
|
||
class PersistenceSerializerDocSpec extends WordSpec { | ||
|
||
val customSerializerConfig = | ||
""" | ||
//#custom-serializer-config | ||
akka.actor { | ||
serializers { | ||
my-payload = "docs.persistence.MyPayloadSerializer" | ||
my-snapshot = "docs.persistence.MySnapshotSerializer" | ||
} | ||
serialization-bindings { | ||
"docs.persistence.MyPayload" = my-payload | ||
"docs.persistence.MySnapshot" = my-snapshot | ||
} | ||
} | ||
//#custom-serializer-config | ||
""".stripMargin | ||
|
||
SerializationExtension(ActorSystem("doc", ConfigFactory.parseString(customSerializerConfig))) | ||
} | ||
|
||
class MyPayload | ||
class MySnapshot | ||
|
||
class MyPayloadSerializer extends Serializer { | ||
def identifier: Int = 77124 | ||
def includeManifest: Boolean = false | ||
def toBinary(o: AnyRef): Array[Byte] = ??? | ||
def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? | ||
} | ||
|
||
class MySnapshotSerializer extends Serializer { | ||
def identifier: Int = 77125 | ||
def includeManifest: Boolean = false | ||
def toBinary(o: AnyRef): Array[Byte] = ??? | ||
def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? | ||
} |
Oops, something went wrong.