-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make entries with legacy class names backwards compatible #14
make entries with legacy class names backwards compatible #14
Conversation
scala/src/main/scala/pekko/contrib/persistence/mongodb/MongoDataModel.scala
Outdated
Show resolved
Hide resolved
scala/src/main/scala/pekko/contrib/persistence/mongodb/MongoDataModel.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would adjust the replacement of "akka" in classnames to make it more bulletproof
I cleaned it up and followed your suggestion good catch there to replaceFirst. I also realized we need to backport this to the old plugin to support roll backs, see this comment on the issue #10 |
Thanks for the contribution @bdoyle0182 👍 |
PSA for anyone that might hit the same issue as me: this fix unfortunately doesn't seem to address a similar issue with
After digging deeper I found out that Line 44 in b8127da
returns:
Which is thrown from https://github.com/apache/incubator-pekko/blob/main/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala#L246 Theory: a replacement of |
Ok, a hacky workaround that I came up with:
serialization
.deserialize(snapshotBytes, serializerId, manifest)
.recoverWith {
case _: NotSerializableException if manifest.startsWith("akka") =>
serialization.deserialize(snapshotBytes, serializerId, manifest.replaceFirst("akka", "org.apache.pekko"))
}
.get
I'm not sure if it makes sense to propose the change from point 2. to the main pekko repo 🤔 |
@SakulK could you create a discussion at https://github.com/apache/incubator-pekko ? It seems like we might need doc or code changes in core pekko to help here. One thing though - have you tried just having the akka jars on your classpath? Akka and Pekko use different package names so they shouldn't affect each other. In theory having the akka jars on your classpath should stop you getting class not found errors. |
@pjfanning I did a quick test with akka-actor and akka-persistance on the classpath and it didn't help, the error did change though:
|
fixes the issue where features of akka / pekko that are dependent on the persistence module and will potentially store the class name of an akka / pekko class as a part of the persisted data.