Hi there,
please always state which journal you're using when talking about serialization 
in Akka Persistence.
It's up to the Journal to decide how to serialize things, it does not have to 
use Akka Serialization at all (!).

In your case I believe you're using the in memory-journal, thus the serializer 
will never kick-in, that's the purpose of the in-mem journal, 
it should not serialize anything, just keep the normal objects in memory.

Read this docs page to understand how and why serialization works this way in 
persistence:
http://doc.akka.io/docs/akka/snapshot/scala/persistence-schema-evolution.html#Picking_the_right_serialization_format

In general, because different journals may have different capabilities (for 
example an SQL store may want to store things in different columns, as it's 
native datatypes, not binary blobs - which Akka Serialization generates), the 
Journal is to decide how it serializes things.

If you want to test serialization locally, use the LevelDB journal plugin (it's 
documented here: 
http://doc.akka.io/docs/akka/snapshot/scala/persistence.html#Local_LevelDB_journal
 )

Happy hakking!

-- 
Cheers,
Konrad `ktoso` Malawski
Akka @ Typesafe

On 29 September 2015 at 06:09:05, pjan vandaele ([email protected]) wrote:

Hi all,

I'm trying to use a custom serializer for an Event using akka-persistence, but 
the serializer is never getting called. My configuration is as follows


akka {
  actor {
    serializers {
      myser = "serializers.PostCreatedSerializer"
    }

    serialization-bindings {
      "domain.protocol.PostCreated" = myser
    }
  }
}

WIth the serializer as follows:

class PostCreatedSerializer extends Serializer {

  def identifier: Int = 523010842

  def includeManifest: Boolean = false

  def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = {
    PostCreated(title = "reloaded")
  }

  def toBinary(obj: AnyRef): Array[Byte] = {
    "test".asBytes
  }
}

I know it's not doing the write thing right now, but I just want to check 
whether it is getting called -> title should change to "reloaded". 
Unfortunately, it isn't.

Been spending over 6 hours trying out different configurations, but nothing 
seems to work.

Any ideas?
thanks,

pjan
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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