0

I send case class using:

tcpActor ! Tcp.Write(MyCaseClass(arg1: Class1, arg2: Class2).data)

Then I received:

case Tcp.Receive(data: ByteString)

Is there any simple way to match data on MyCaseClass without using low level java serializer?

galvanize
  • 537
  • 1
  • 5
  • 17

2 Answers2

2

I'm not sure if akka provides any facility for de-serialising binary data, I didn't find any so far. A good option would be to use scodec, which seems pretty good and quite popular in the scala ecosystem. By the way, where is that .data method you are using to serialise defined?

Aldo Stracquadanio
  • 6,167
  • 1
  • 23
  • 34
1

Your options:
1. Use Akka remoting to send the case classes directly
2. Use Java serialization
3. Use https://github.com/scala/pickling
4. Write your own message protocol to convert between case classes and byte strings

Choose what best fits your use case.

Quizzie
  • 879
  • 4
  • 15