in core/src/main/scala/org/apache/pekko/persistence/jdbc/PekkoSerialization.scala [42:69]
def fromRow(serialization: Serialization)(row: JournalPekkoSerializationRow): Try[(PersistentRepr, Long)] = {
serialization.deserialize(row.eventPayload, row.eventSerId, row.eventSerManifest).flatMap { payload =>
val metadata = for {
mPayload <- row.metaPayload
mSerId <- row.metaSerId
} yield (mPayload, mSerId)
val repr = PersistentRepr(
payload,
row.sequenceNumber,
row.persistenceId,
row.adapterManifest,
row.deleted,
sender = null,
writerUuid = row.writer)
// This means that failure to deserialize the meta will fail the read, I think this is the correct to do
for {
withMeta <- metadata match {
case None => Success(repr)
case Some((payload, id)) =>
serialization.deserialize(payload, id, row.metaSerManifest.getOrElse("")).map { meta =>
repr.withMetadata(meta)
}
}
} yield (withMeta.withTimestamp(row.writeTimestamp), row.ordering)
}
}