Where's the value of the salt? You're printing a default string 
representation of a ByteString object, and the hex value given is a hash of 
the object's address, not a representation of its value.


On Wednesday, September 20, 2017 at 3:47:31 PM UTC-4, IceBreaker wrote:
>
>
> I am using akka persistence to persist an array of bytes with Google 
> Protobuf using Akka Cassandra.  I have attached a data model adapter to 
> convert between the domain model and data model.  When I deserialize the 
> salt, it gives back a different value.  I have tested other fields like 
> email that gets serialized with the object and everything is fine.  Why is 
> bytes persisting in Cassandra incorrectly?
>
> *Serialize:*
>
> val bytes = salt.map(ByteString.copyFrom)
> logger.info(s"bytes: $bytes")
> val value = salt.map(b ⇒ new String(b))
> logger.info(s"value: $value")
>
> logger.info(s"email: ${email}")
>
>
> Send [UserRegisteredV2] event to journal
> [cassandra-plugin-default-dispatcher-5] INFO User [DataModelAdapter] - 
> bytes: Some(<ByteString@f01ec80 size=20>)
> [cassandra-plugin-default-dispatcher-5] INFO User [DataModelAdapter] - 
> value: Some(}�}�e I
> '��U���敾d)
> [cassandra-plugin-default-dispatcher-5] INFO User [DataModelAdapter] - 
> email: Some([email protected] <javascript:>)
>
>
>
> *Deserialize:*
>
> val bytes = salt.map(_.toByteArray) // google protobuf salt
> logger.info(s"bytes: ${salt.get}")
>
> val value = saltValue.map(_.getBytes) // googe protobuf string
> logger.info(s"value: ${saltValue.get}")
>
> logger.info(s"email: ${email}")
>
> Deserialize [UserRegistered] persistent event
> [akka.actor.default-dispatcher-9] INFO User [DataModelAdapter] - Receive [
> UserRegisteredV2] event from journal
> [akka.actor.default-dispatcher-9] INFO User [DataModelAdapter] - bytes: <
> ByteString@5b66524 size=20>
> [akka.actor.default-dispatcher-9] INFO User [DataModelAdapter] - value: 
> }�}�e I
> '��U���敾d
> [akka.actor.default-dispatcher-9] INFO User [DataModelAdapter] - email: 
> Some([email protected] <javascript:>)
>
>
>
>    
>

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to