我正在使用 Akka HTTP cachedHostConnectionPoolHttps 池作为 Akka Streams Flow 的一部分发送请求:
private val requestFlow: Flow[(HttpRequest, HelperClass), Either[Error, String], _] =
Http().cachedHostConnectionPoolHttps(BaseUrl).mapAsync(1) {
case (Success(HttpResponse(_, _, entity, _)), _) =>
Unmarshal(entity).to[String].map(response => {
Right(response)
})
case (Failure(ex), _) =>
Future(Left(Error(ex)))
}
由于某种原因,并未处理所有请求响应。部分结果报错:
a.h.i.e.c.PoolGateway - [0 (WaitingForResponseEntitySubscription)] Response entity was not subscribed after 1 second. Make sure to read the response entity body or call `discardBytes()` on it.
如何在保持上述流程的同时订阅我的回复?
虽然这不是最好的解决方案,但您可以像这样增加响应订阅超时:
akka.http.host-connection-pool.response-entity-subscription-timeout = 10.seconds
这是更彻底的讨论:https://github.com/akka/akka-http/issues/1836 https://github.com/akka/akka-http/issues/1836
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)