A component BEAUTIFUL
is using her internal akka.actor.Actor
to do certain things.. ( such as "acting up" for example )
There are other MAN
components that would really like to "interact" with the BEAUTIFUL
When the BEAUTIFUL
finds a MAN
worthy, before "interacting" with him, she agrees to take in his phone number ( let's call it an ErrorHandler
), you know just to give him a call in case he left in the morning and forgot his Rolex on her bed side table
The BEAUTIFUL
though is "high maintenance" ( aren't they all.. ), and every time something bad happens inside the BEAUTIFUL
's internal Actor ( e.g. an OmgBrokenNailException
, UglyPurseThrowable
, etc.. ), she goes nuts, needs to stop completely and to call a MAN
using that phone number ( e.g. errorHandler.getOnItNowHoney( message, throwable )
)
AKKA supervisors allow to register two types of FaultHandlers => OneForOneStrategy
and AllForOneStrategy
, where if the underlying Actor overrides preRestart/postRestart, it gets access to an actual "throwable" e.g.:
override def preRestart( reason: Throwable ) { // do with throwable... }
The problem is both of these strategies will try to restart the Actor(s), which is not something that I am looking for. I am looking for the Actor to call an external ErrorHandler
with the "throwable" and stop.
If I don't use these strategies, when exception is thrown from within the Actor, a postStop
is called on the Actor, which is cool, but it does not take in a "throwable":
override def postStop() { // no access to "throwable"... }
Help the MAN
to get that throwable
In Akka 2 you should use DeathWatch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With