Hi everyone,
we've discussed about serialization formats a few times on this list,
I think the discussion here: Best practices using Akka Persistence with
long-running projects?
<https://groups.google.com/forum/#!searchin/akka-user/Best$20practices$20using$20Akka$20Persistence$20with$20long-running$20projects/akka-user/xNtxm8sLtO0/6FcJNbbgoY0J>
was
one of the most interesting ones, listing the multiple available
serialization formats and their tradeoffs.

Also, protocol buffers supports maps since 3.0+:
https://github.com/google/protobuf/releases/tag/v3.0.0-alpha-2
Avro does support maps as well: http://avro.apache.org/docs/1.3.0/spec.html

The serialization format you pick is one of the most important choices when
designing these systems - you should take some time and research all
available options.

On Tue, Apr 21, 2015 at 7:00 PM, Jason Law <ja...@lawcasa.com> wrote:

> Martin, I'm curious about your protobuf recommendation. I plan to persist
> events and snapshots, and evolve the schema over time. Protobuf seems to
> have the best support for evolution, but it's not perfect, and I feel quite
> constrained by the generated code. For example, if I'm persisting a
> collection of objects, but the way I want to use that collection when
> deserialized is in a Map, then I've got to go through an extra
> transformation (Seq to Map). But maybe I'm over thinking it, or thinking
> about this challenge in the wrong way. Any insights?
>
> On Monday, May 19, 2014 at 10:05:56 PM UTC-6, Martin Krasser wrote:
>>
>>  Hi Odd,
>>
>> why have you chosen this versioning approach instead of a protobuf based
>> one, for example? What are the advantages?
>>
>> On 19.05.14 14:08, Odd Möller wrote:
>>
>>  Hi!
>>
>>  We have a versioning extension that we are experimenting with at the
>> moment (it is quite experimental at this point and completely without
>> tests):
>> https://github.com/odd/akka/tree/wip-persistence-odd/akka-contrib/src/main/scala/akka/contrib/persistence/versioning
>>
>>  The basic idea is to attach a version to the actual data to be
>> persisted and then when saving the data, instead of serializing the data
>> class as is, save a tuple containing the data of the fields of the class.
>> Then at load time you can transform historic versions of the saved data to
>> the latest version (based on the attached version).
>>
>>  For example:
>>
>>  import akka.contrib.persistence.versioning._
>>
>>  // Version 1 -- present in the event log but no longer available at
>> runtime
>>  // case class Name(first: String, last: String) extends Versioned[Name]
>>
>>  // Version 2 -- current version of the class at runtime
>>  case class Name(first: String, last: String, title: Option[String] =
>> None) extends Versioned[Name]
>>
>>  object Name extends Versioned.Companion[Name] {
>>    override def apply(data: (Version, Any)): Name = {
>>     case (Version.Major(1), (first: String, last: String)) => Name(first,
>> last)
>>      case (Version.Major(2), (first: String, last: String, title:
>> Option[String])) => Name(first, last, title)
>>      case (v, d) => throw new IllegalStateException(s"Unknown version
>> encountered [version: $v, data: $d]")
>>   }
>> }
>>
>>  The versioned serializer needs to be present in the akka config:
>>
>>  serializers {
>>   versioned = "akka.contrib.persistence.versioning.VersionedSerializer"
>>  }
>> serialization-bindings {
>>   "akka.contrib.persistence.versioning.Versioned" = versioned
>> }
>>
>>
>> On Thu, May 15, 2014 at 7:41 PM, Per Johansson <per.j.j...@gmail.com>
>> wrote:
>>
>>> What about using "versioned" objects (like Foo_v01, Foo_v02) and convert
>>> to the latest version when reading a snapshot?
>>>
>>> Anyone with experience of that approach?
>>>
>>> Was thinking it might be less work if you want to have e.g. maps after
>>> derserialization? (maps not supported in protobuf)
>>>
>>> /Per
>>>
>>> On Thursday, 8 May 2014 09:47:46 UTC+1, Martin Krasser wrote:
>>>
>>>>
>>>> On 08.05.14 10:43, Tim Pigden wrote:
>>>>
>>>> Hi
>>>> I've found a new thing to worry about :-)
>>>> If I use an eventsource model and content myself with the default
>>>> serialization and akka persistence, what's the likelihood of my serialized
>>>> objects becoming unreadable in the future? What's the long-term stability
>>>> of the default akka serialization mechanism?
>>>>
>>>>
>>>> By default, events are serialized with Akka's Java serializer.
>>>>
>>>>  Is there a recommendation?
>>>>
>>>>
>>>> Use a custom
>>>> <http://doc.akka.io/docs/akka/2.3.2/scala/persistence.html#custom-serialization>
>>>> protobuf (or similar) serializer to serialize your events. This will
>>>> support backwards compatible changes to your event schema.
>>>>
>>>>   Tim
>>>>  --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ:
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives:
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>>  To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to akka-user+...@googlegroups.com.
>>>> To post to this group, send email to akka...@googlegroups.com.
>>>>
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>>> Martin Krasser
>>>>
>>>> blog:    http://krasserm.blogspot.com
>>>> code:    http://github.com/krasserm
>>>> twitter: http://twitter.com/mrt1nz
>>>>
>>>>    --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >>>>>>>>>> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Martin Krasser
>>
>> blog:    http://krasserm.blogspot.com
>> code:    http://github.com/krasserm
>> twitter: http://twitter.com/mrt1nz
>>
>>   --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to