Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

Create, kill and create again an actor

$
0
0

Who could point me to the documentation on how to create and kill actors?
From what I read from the docs I could kill any actor by sending akka.actor.PoisonPill

Then I’m trying, just for experiment, to create and kill the akka.io.IO(akka.io.Dns) actor.

What I’m doing:

def getActor() = {
  akka.io.IO(akka.io.Dns) !  akka.actor.PoisonPill // create and kill
  akka.io.IO(akka.io.Dns)                          // create new one and return
}

The problem is that after such manipulation I can not lookup any domains via dns resolver. More over akka.http.client does not work as domanis could not be resolved.

Http()(system)
      .singleRequest(
        HttpRequest(
          method = HttpMethods.HEAD,
          uri = uri,
          headers = List(`User-Agent`(USER_AGENT))
        )
      )

Logs:

akka.actor.RepointableActorRef - Message [akka.io.dns.DnsProtocol$Resolve] to Actor[akka://grpcServer/system/IO-DNS#1709053396] was not delivered. [3] dead letters encountered. If this is not an expected behavior then Actor[akka://grpcServer/system/IO-DNS#1709053396] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.

...akka.stream.StreamTcpException: Tcp command [Connect(google.com:80,None,List(),Some(3 seconds),true)] failed because of akka.io.TcpOutgoingConnection$$anon$2: Connect timeout of Some(3 seconds) expired

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1362