I have a very simple use case of Akka Projection.
I use Avro for event serialization, and only need to move certain types of events to Kafka, in the same serialized format. There is no need to go through the deserialize-serialize cycle since Kafka can ingest serialized Avro data.
I can’t find how to bypass deserialization from the documentation of Akka Projection. Is it possible?
It would be great if I can use Akka Projection for it. Otherwise, I would have to write my own streaming job.
case class RawEvent(bytes: Array[Byte], manifest: String)
def fromBinary(bytes: Array[Byte], manifest: String): RawEvent = RawEvent(bytes, manifest)
How can I override the serializer binding in Akka Projection? Suppose I run Akka Persistence and Projection in the same application.
I hope Akka allows me to use a different serializer to deserialize the value serialized by the original sseriialzier. They will definitely have different serializer ids.
Note that you will not be able to selectively use the RawEvent only for the deserialization in the projections, but you would also use it from the EventSourcedBehavior. That might not be so nice, but you can hide that with an EventAdapter Event Sourcing • Akka Documentation
OK. I don’t want to change the existing serializers. I think I’m going to run the projection job as a separated app with its own config fire where I create instances of the dummy serialize but with Ids copied from the real serializers so that the events can be read as bytes.