-
Notifications
You must be signed in to change notification settings - Fork 39
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
Stash not available under Scala 3 (with CrossVersion) #130
Comments
Hi @devlaam ! There is a section on how to configure the mailbox in the main Readme: Lines 91 to 110 in 040fac8
I'm not sure how the macro incompatibility works in Scala 3, but if you insert a local variable in the String to parse you invalidate the Macro and everything should be resolved at runtime, but this might require more investigation. Alternatively, you can try to use parseMap , or directly invoking the underlying implementation.
|
Hello andreaTP, thanks a lot for the quick reply!! I already tried the way you suggested, but failed. But, since you suggested it, I thought, let's try a little harder. This is a solution i found to be working. Define your actor system with: object SystemDef
{ import com.typesafe.config.{Config => TSConfig}
import org.akkajs.shocon.{Config => SHConfig}
val actSysName = "mySystem"
val stashMailbox = "stash-custom-mailbox"
val stashConfig = s""" $stashMailbox { mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox" } """
val actorSystem = ActorSystem(actSysName,TSConfig(SHConfig(stashConfig))) } and make use of it like this: object Worker
{ case class Config(...)
def create(config: Config): Props = Props(new Worker(config)).withMailbox(SystemDef.stashMailbox) }
class Worker(val config: Worker.Config) extends Actor with Stash
{ ... } Again, a big thank you (and for your wonderful work in general). Happy stashing! |
Thanks a lot for sharing your solution @devlaam ! |
Akka.js continues to be very useful! However, when taking my project to Scala 3 (and making use of
CrossVersion.for3Use2_13
) a problem with the use ofStash
arises. It seems not possible to define mailbox configurations inapplication.conf
for that file is not being read, and making use of thenConfigFactory
does not work for it relies on Scala 2 macro's (not supported in Scala 3). Making an alternativeStash
class is also difficult for the underlying queues in the mailboxes are not accessible (needed to get the order right).Is there a way to somehow manually load the required mailbox class? Or do you know some other workaround?
The text was updated successfully, but these errors were encountered: