Unreachable remote akka actor

268 Views Asked by At

I'm trying to send a message to an actor that is not brought up yet. When I do so, I see following message on the console but how to capture this error programatically / through configuration.

[WARN] [09/25/2017 14:15:01.127] [JavaEngineSystem-akka.remote.default-remote-dispatcher-6] [akka.tcp://JavaEngineSystem@018x02h2:1727/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FScalaEngineSystem%40018x02h2%3A4090-0] Association with remote system [akka.tcp://ScalaEngineSystem@018x02h2:4090] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ScalaEngineSystem@018x02h2:4090]] Caused by: [Connection refused]
[INFO] [09/25/2017 14:15:01.141] [JavaEngineSystem-akka.actor.default-dispatcher-3] [akka://JavaEngineSystem/deadLetters] Message [com.impl.ActorMessage] from Actor[akka://JavaEngineSystem/temp/$a] to Actor[akka://JavaEngineSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.

This is my system initialization part of the code:

system = ActorSystem.create("JavaEngineSystem", ConfigFactory.load(ScalaAkkaAccessor.class.getClassLoader()));
        thisActor = system.actorOf(Props.create(AvroActor.class), "javaEngine");
        List<String> paths = new ArrayList<String>();
        StringTokenizer tokenizer = new StringTokenizer(akkaUrl, ",");
        while(tokenizer.hasMoreTokens()) {
            paths.add(tokenizer.nextToken());
        }
        scalaEngineRouterRemote = system.actorOf(new RoundRobinGroup(paths).props(), "router4");

Message sending code:

Timeout timeout = new Timeout(Duration.create(timeoutDuration, "minute"));
        ActorMessage msg = new ActorMessage();
        msg.setStr(OPER);
        Future<Object> future = Patterns.ask(scalaEngineRouterRemote, msg, timeout);
        Object retn = Await.result(future, timeout.duration());

Basically i'm trying to recover immediately after I know that remote actor is not available (or not running) rather than waiting for timeout.

0

There are 0 best solutions below