ฉันกำลังพยายามส่งสองสามร้อยร้องขอ http จาก akka นักแสดงแต่ฉันกำลังจะ
akka.stream.BufferOverflowException: Exceeded configured max-open-requests value of [16]. This means that the request queue of this pool (HostConnectionPoolSetup(places.api.here.com,443,ConnectionPoolSetup(ConnectionPoolSettings(16,1,5,16,1,Duration.Inf,100 milliseconds,2 minutes,30 seconds,ClientConnectionSettings(Some(User-Agent: akka-http/10.2.0)...
นี่การทำงานของโปรแกรมconf
http {
host-connection-pool {
max-connections = 16
min-connections = 1
max-open-requests = 16
}
}
นี่รหัส
override def receive: Receive = {
case Foo(_) =>
val res: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = "http://..."))
// do something for the result
ฉันพยายามจะควบคุมโดยรัฐ e.g
override def receive: Receive = run(0)
def run(openRequests: Int) : Receive = {
case Foo(_) if openRequests <= 16 =>
context.become(run(openRequests + 1))
val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = "http://..."))
responseFuture.foreach(context.become(run(openRequests - 1)))
//...
ยังไงฉันก็เหมือนกันข้อยกเว้นของ BufferOverflowException
คำแนะนำบางอย่างจะ greatly รู้สึกขอบคุณ