I am keen on getting to know akka, and thanks to every creator of akka involved.
I started with a recursive zipping job, i.e. anonymous agents (Behaviours) are spawned with the intention to do the nested work until every work is done (divide & conquer).
The entire zip-job should fail, in case of an occuring nested exception anywhere within the call stack.
According to my current state of knowledge I have implemented all parts properly in order to bubble up the exception, according to the Akka documentation on fault-tolerance.
Root-Parent: .onFailure(SupervisorStrategy.stop());
Parents: .onSignal(ChildFailed.class, this::onChildFailed)
.getContext().watch(commandActorRef);
It basically works as intended: Everything is shutting down, on the occurance of a nested exception.
However, in my root-parent agent onChildFailed (.onSignal(ChildFailed.class, this::onChildFailed)), I have not found a way to obtain the root cause, which is my goal.
Although the root-parent agent receives a DeathPactException, it does not appear to provide access to initial exception, in my case an IllegalStateException(“Intentional exception on …”)
The root cause does not appear on the console output.
The project is here: https://github.com/koelleChristian/actor-model-showcases
The akka stuff is here: https://github.com/koelleChristian/actor-model-showcases/tree/main/actor-model-zip-showcase-akkazipjob
There is a picture of the actor model in the project root folder’s ReadMe.adoc.
The situation can be reproduced by launching the following class with the jvm-parameters:
de.koelle.christian.actorshowcase.akkazip.ziptyped.Main
-Dde.koelle.christian.actorshowcase.common.produce.intentional.exception.enabled=true
-Dde.koelle.christian.actorshowcase.common.intentional.exception.trigger.zipfilename=File_1_2
- Any help, how to achieve my goal - obtain the root cause - is appreciated.
- Can this even be achieved with the SupervisorStrategy.stop() or should I use messages to reimplement the root cause exception communication from the causing agent to the root-parent agent, i.e. handling java exceptions without java exceptions?
- Am I fundamentally misuaging the framework?
By the way: I don’t understand why the ZipJobActorTest.java’s probe does not receive any message when the work has been successfully completed.
Thanks in advance and regards
Christian