我正在编写简单的spray客户端代码:
// 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'.我该怎么做才能解决这个问题呢?
发布于 2016-02-18 05:49:13
这不一定是个问题。这是来自documentation的代码片段。
默认情况下,发送到死信的消息被记录在信息级别。死信的存在并不一定表明存在问题,但它可能是问题,因此默认情况下会记录这些死信。在收到几条消息后,此日志记录将被关闭,以避免淹没日志。您可以完全禁用此日志记录,或调整记录的死信数量。在系统关闭期间,您可能会看到死信,因为参与者邮箱中的挂起消息将发送到死信。您还可以在关机期间禁用死信记录。
我在服务器启动时忽略它们。
https://stackoverflow.com/questions/35458446
复制相似问题