Hi guys,
After reading more the documentation about the fault tolerance in Akka, I'm trying to a define a new guardian supervisor strategy like below :
package foo
import akka.actor.{OneForOneStrategy, SupervisorStrategy, SupervisorStrategyConfigurator}
import akka.actor.SupervisorStrategy.{Decider, Resume}
/**
* Created by alifirat on 17/01/17.
*/
object Foo {
final val resumeDecider: Decider = {
case _: Exception => Resume
}
final val resumeStrategy: SupervisorStrategy = OneForOneStrategy()(resumeDecider)
final class ResumeSupervisorStrategy extends SupervisorStrategyConfigurator {
override def create() = resumeStrategy
}
}
And in one my test, I try to set this new supervisor strategy like this :
class TEST_DEVICES_ROUTER_RECEIVE_DEVICES_DATA_AND_EXCEPTIONS
extends TestKit(ActorSystem("TEST_DEVICES_ROUTER_RECEIVE_DEVICES_DATA", ConfigFactory.parseString("""
akka.actor.guardian-supervisor-strategy = "foo.Foo.ResumeSupervisorStrategy"
""")))
with FlatSpecLike
with Matchers
with BeforeAndAfterAll
with MockitoSugar
with LazyLogging {
But when I run the test, I got the following exception :
info] TEST_DEVICES_ROUTER_RECEIVE_DEVICES_DATA_AND_EXCEPTIONS *** ABORTED ***
[info] java.lang.ClassNotFoundException: foo.Foo.ResumeSupervisorStrategy
[info] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[info] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[info] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[info] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[info] at java.lang.Class.forName0(Native Method)
[info] at java.lang.Class.forName(Class.java:348)
[info] at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(ReflectiveDynamicAccess.scala:21)
[info] at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(ReflectiveDynamicAccess.scala:20)
[info] at scala.util.Try$.apply(Try.scala:192)
[info] at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:20)
[info] ...
The path of the class ResumeSupervisorStrategy seems to be good but it seems that I didn't an another thing which I cannot fix. Any help will be appreciate !