Scala Akka Actors

Good morning all :)

This is my first time posting, so sorry for any misunderstandings or lack of explanation.

I am trying to implement a monitoring system, with the help of Scala and Java. To do so I found Akka actors to the most suitable in order to let the system and the monitor to communicate. But I am still finding a bit tedious in understanding the main concepts of Behaviors, etc.

I want to execute a process in the sense that I want to create a new process/actor which executes a particular function : property(). Could you kindly guide me on what is best to do please ?

Attached please find a code sample of my project :)

> val actorSystem:ActorSystem[ReceivedCommands] = ActorSystem(Behaviors.empty, name = "SHML_Actor_System")
>     val SystemRef = actorSystem.systemActorOf(Mon_Initiation("", null), "SystemRef")
>     val MonitorRef = actorSystem.systemActorOf(start_monitor(actorSystem, SystemRef, PropertyParam), "MonitorRef")
> logger.info("Spawning and starting property monitor")
>         val MonitorProcess = actorSystem.systemActorOf(LaunchClass(actorSystem), "MonitorProcess")
>         sleep(1000)
>         logger.info("Starting main monitor loop")

and in the LaunchClass :

> object LaunchClass {
> 
>   def apply(actorSystem: ActorSystem[ReceivedCommands]): Behavior[MainMon.ReceivedCommands] = {
>     val fun = actorSystem.systemActorOf(LaunchClass.fun(), "fun")
>     fun ! start()
>     Behaviors.same
>   }
> 
>   private def fun(): Behavior[MainMon.ReceivedCommands] =
>     Behaviors.receiveMessage {
>       _ =>
>         def property(): Behavior[String] = {
>           Behaviors.receiveMessage {
>             case "send" => Formula.mon_ff()
>               Behaviors.same
>             case _ =>
>               Formula.mon_id()
>               Behaviors.same
>           }
>         }
>         Behaviors.same
>     }
> }

Thanks a lot and stay safe :)