Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Akka - when should I use the Bootable class

Tags:

scala

akka

In Akka, I can initialize an actor system from the main(), like this:

object HostManagerApp {
  def main(args: Array[String]) {
    val system = ActorSystem("Foo", ConfigFactory.load.getConfig("Bar"))
  }
}

Alternatively, I can do the same from a class that extends Bootable. As mentioned in the docs, this also allows me to start the app from the command line. What's the difference between the two approaches?

like image 270
jeffreyveon Avatar asked Feb 15 '26 02:02

jeffreyveon


2 Answers

Its a way to make your code more modular. Using Bootable you can have different independent actor systems in different scala classes all bootstrapping independently, instead of putting them all in one main class.

like image 102
FUD Avatar answered Feb 16 '26 15:02

FUD


Bootable is used with the Akka Microkernel, and if you package your Akka application as a Bootable then you can run multiple applications within the same ActorSystem.

like image 28
Viktor Klang Avatar answered Feb 16 '26 16:02

Viktor Klang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!