我正在编写简单的喷涂客户端代码:
// ActorSystem("main-actor-system") initialized earlier in code
implicit val system = actorSystem
implicit val execctx: scala.concurrent.ExecutionContext = system.dispatcher
implicit val timeout = Timeout(10.seconds)
val pipeline: Future[pipelining.WithTransformerConcatenation[HttpRequest, Future[String]]] =
for ( Http.HostConnectorInfo(connector, _) <-
IO(Http) ? Http.HostConnectorSetup("myservicehost", port = 80)
) yield sendReceive(connector) ~> unmarshal[String]
Await.ready(pipeline, 10 seconds)
// this is quite brute forse, what is better way?
val pl = pipeline.value.get.get
val response: Future[String] = pl { Get("/status")}
private val result: String = Await.result(response, 10 seconds)
response.foreach(r => println("result" + result))
每次我运行此代码时,我都会
[INFO] [02/17/2016 15:31:15.596] [main-actor-system-akka.actor.default-dispatcher-3] [akka://main-actor-system/system/IO-TCP/selectors/$a/0] Message [akka.io.Tcp$Close$] from Actor[akka://main-actor-system/user/IO-HTTP/group-0/0#-1771046370] to Actor[akka://main-actor-system/system/IO-TCP/selectors/$a/0#1352725834] 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'.
我该怎么做才能解决这个问题?
答案 0 :(得分:0)
这不一定是个问题。以下是documentation的摘录。
默认情况下,会在信息级别记录发送到死信的消息。死信的存在并不一定表示存在问题,但可能存在,因此默认情况下会记录它们。在几条消息之后关闭此日志记录,以避免日志泛滥。您可以完全禁用此日志记录,也可以调整记录的死信数量。在系统关闭期间,您可能会看到死信,因为actor邮箱中的待处理邮件被发送到死信。您还可以在关机期间禁用死信的记录。
我在启动服务器时忽略它们。