In my usecase, I have a SourceEvent case class which can take an instance of a generic type as a parameter like this:
case class SourceEvent[T](event: T, hash: Int = 0) extends Command
When the SourceEvent is being constructed, T is being passed as a Tuple2 like:
SourceEvent[(String,String)](("abc","sample-event"), hash = "sample-event".hashCode)
When this is received by a Behavior, tuple is being treated as list like this:
message match {
case m: SourceEvent[(String,String)] =>
context.log.info(s"Message received : ${m}")
Behaviors.same
}
It's printing the below log:
Message received : SourceEvent(List(abc,sample-event),-1486933305)
While trying to access any fields for the tuple like m.event._1, the below exception is being thrown:
[local-test-akka.actor.default-dispatcher-5] ERROR akka.actor.SupervisorStrategy - scala.collection.immutable.$colon$colon cannot be cast to scala.Tuple2
How do we deserialize a Tuple as it is using jackson-json serialization in akka!!