GithubHelp home page GithubHelp logo

Comments (14)

gervaisb avatar gervaisb commented on September 22, 2024 1

At least we do not have any errors at this time..
I was not aware of the SerializationTestKit, that's very good to know. I'm going to use it and update that issue accordingly.

I learnt about the plugin from Twitter: https://twitter.com/VirtusLab/status/1570312428218466306

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024 1

@gervaisb actually... work in progress ;) #304

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024 1

Just upgraded to 0.7.0 everything is okay with the new parameter.

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Hmmm I'm not sure if these are truly false positives... do Either[_,_] and subclasses of scalapb.GeneratedMessage actually serialize successfully with Akka? 🤔 SerializationTestKit can be used to be make sure.

Btw out of curiosity, how did you learn of our plugin? ;)

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Ok! lmk how it goes and we'll think if/how to address

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024

Hi there. Back with my "issue".

I do have this test that pass for a message with an Either.

// testKit: akka.actor.testkit.typed.scaladsl.ActorTestKit = ...
val probe = testKit.createTestProbe[Either[SampleError, SampleEvent]]()
val replyTo: ActorRef[Either[SampleError, SampleEvent]] = probe.ref

val subject = MessageWithEither(
    "Hello", replyTo
)
new SerializationTestKit(system)
    .verifySerialization(subject)

The system is configured with:

akka {
  actor {
    serializers {
      // ...
      jackson-cbor = "akka.serialization.jackson.JacksonCborSerializer"
    }
    serialization-bindings {
      // ...
      "scala.util.Either" = jackson-cbor
    }
  }
}

However, ASH report an error:

Either[org.acme.SampleError, org.acme.SampleEvent] is used as Akka message but does not extend a trait annotated with org.virtuslab.ash.annotation.SerializabilityTrait.
[error] Passing an object of a class that does NOT extend a trait annotated with org.virtuslab.ash.annotation.SerializabilityTrait as a message
[error] may cause Akka to fall back to Java serialization during runtime.
[error]
[error] replyTo: ActorRef[Either[SampleError, SampleEvent]]

You are right, Either[_,_] is not "natively serializable" with Akka. However, if I'm not mistaken, it should be in this case.

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Wow good to know đŸ˜¯ Indeed, there should be a mechanism for marking certain types defined outside the user codebase as safe for serialization. There's a predefined list... but that's not configurable, alas ☚ī¸

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024

Okay, thanks.

We use Either on commands only. But we do have some snapshots that are not serializable. Is there any way to "exclude" our commands from your plugin, but keep all classes related to the states?

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Is there any way to "exclude" our commands from your plugin, but keep all classes related to the states?

Unfortunately, there's currently some configurability (https://github.com/VirtusLab/akka-serialization-helper/blob/main/docs/GUIDE.md#serializability-checker-compiler-plugin)... but that probably doesn't cover your case in any useful manner.

Just out of curiosity... would you be interested in providing a contribution to this repo? Ofc with review & all needed support on our side. We'll eventually be able to implement it ourselves as well (esp. given that there's an external interest in the project)... but it might take a longer while (as we're busy in unrelated projects that don't even use ASH) :///

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024

Just out of curiosity... would you be interested in providing a contribution to this repo?

I'd love to. Unfortunately, I do not see much time on the coming months.

Thanks for the effort in #304 ! Awesome.

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Okay I've merged #304 and got a snapshot release ready... if @gervaisb you could:

  1. set up access to snapshots as in the docs: https://github.com/VirtusLab/akka-serialization-helper/blob/main/CONTRIBUTING.md#snapshots
  2. use the snapshot version 0.6.2+59-f4224184-SNAPSHOT (see Sonatype repo) instead of 0.6.2 you've got now (I suppose)
  3. use the newly-added --types-explicitly-marked-as-serializable=... flag as in https://github.com/VirtusLab/akka-serialization-helper/blob/main/docs/GUIDE.md#serializability-checker-compiler-plugin

Once I get a good-to-go from you, I'm gonna release this version as v0.7.0 đŸšĸ

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024

Awesome ! Thanks a lot.

Will try that ASAP.

from akka-serialization-helper.

gervaisb avatar gervaisb commented on September 22, 2024

Hello again. I just tested the last snapshot, and it seems to do the Job.

I have configured scala.util.Either and I am not bothered by this type any more but get "true" errors now. 👍

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on September 22, 2024

Hello again. I just tested the last snapshot, and it seems to do the Job.

Gr8! 🎉 I'm running a release of v0.7.0 right now, once the packages make their way to Maven Central (which can take up to 12 hrs), you can replace the snapshot version with 0.7.0.

However, we do have errors for generic types

Hmm this error is probably expected, as there's no guarantee that E will serialize in runtime indeed... would it make sense to provide a lower bound for these types, like abstract class Projection[Event <: MySerializable]?

Otherwise, you can take a look at --disable-detection-generics compiler plugin option (https://github.com/VirtusLab/akka-serialization-helper/blob/main/docs/GUIDE.md#serializability-checker-compiler-plugin)

from akka-serialization-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.