Hi there,
Protocol buffers don't really works on "any case class", you have to map values 
to protoc generated message classes,
(middle collumn in the example), whihc are generated from an IDL shows on the 
left hand side column here:
https://developers.google.com/protocol-buffers/

Read up on how protoc works, that should help a bit to grasp how to go about it 
I think.
You could also use a simpler serialization mechanism, like Kryo or even some 
JSON formats depending on what your use case is.

Protocol buffers are really great at long term schema evolution and overall 
efficiency of serialization,
sadly they require some additional work from you as a developer to prepare the 
messages – a world of tradeoffs we live in :)

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 14 February 2016 at 07:28:07, Lap Ming Lee ([email protected]) wrote:

I have a service that relies on path dependent types for its protocol such that:

class Service[P <: Protocol] extends PersistentActor  {
   type Request = P#Request

   sealed trait RequestEvent
   case class RequestAccepted(id: RequestId, request: Request) extends 
RequestEvent

   override def receiveCommand: Receive = {
      case request: Request => persist(RequestAccepted(request.id, request)) 
{event => ...}
   }
}

The request type is a base type such that any implementation simply extends it 

case class RequestA(id: RequestId, somethingA:Any) extends Request

case class RequestB(id: RequestId, somethingB:Any, processId: String) extends 
Request

How would one go persisting path dependent types with Protobuff in this case?  

Since 

a) RequestAccepted case class cannot be in an object since Request is not known 
outside of Service class

b) Request is only the base type.  How do I ensure it persists the 
implementation type instead?  
=> I read something about extensions and unions, but doesn't it request the 
RequestAccepted case class to specify the implement type instead?


--
>>>>>>>>>> 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.

-- 
>>>>>>>>>>      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