Я использую пул Akka HTTP cachedHostConnectionPoolHttps для отправки запросов как часть потока потоков Akka:
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.
Как подписаться на мой ответ, сохранив при этом поток, указанный выше?