Hi, Akka newbie here, I try the sample on Akka web site and notice the
ActorSystem still runs after the Actors have finished, and I have to hit
Enter to quit. Is there a way to shut down ActorSystem object once
everything is done? I already tried the suggestion to override the
reference.conf file with "akka.actor.guardian-supervisor-strategy = \"
akka.actor.StoppingSupervisorStrategy\"\n" but still no luck. I also
checked with folks on the other Akka chat room and they suggest using Akka
Streams instead of Akka Actors?? Any insight is greatly appreciated!
My public static void main()code:
=================================
Config myConfig =
ConfigFactory.parseString("akka.actor.guardian-supervisor-strategy =
\"akka.actor.StoppingSupervisorStrategy\"\n");
// load the normal config stack (system props, then application.conf, then
reference.conf)
Config regularConfig = ConfigFactory.load();
// override regular stack with myConfig
Config combined = myConfig.withFallback(regularConfig);
// put the result in between the overrides (system props) and defaults again
Config complete = ConfigFactory.load(combined);
// create ActorSystem
ActorSystem system = ActorSystem.create("actorSystem", complete);
final ActorRef taskManagerActor = system
.actorOf(TaskManager.props(taskListList.size(),
new FiniteDuration(30000, TimeUnit.MILLISECONDS)));
for (List<String> taskList : taskListList) {
taskManagerActor.tell(new TaskActor.RunTaskMsg(taskList),
ActorRef.noSender());
}//end for
My TaskManager Actor has a match() to shut itself down and the system down:
===========================================================================
...
.match(TaskManager.TaskCompletedMsg.class, o -> {
if (taskCounter == totalNumTasks) {
System.out.println("\nAll child Actors have been stopped. Shutting down
TaskManager Actor...");
getContext().stop(getSelf());
System.out.println("\nAnd shutting down ActorSystem...");
getContext().getSystem().terminate();
}//end if
})
...
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.