Akka Http: Exceeded configured max-open-requests value of [32]

If you are going to be repeatedly calling your method, you might want to consider using one of the connection pool based client methods as described here: http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/client-side/index.html

You can also set the connection pool settings in the akka-http client configuration: http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/configuration.html#akka-http-core

Search for host-connection-pool.


I went through the docs and tried the following

val connectionFlow: Flow[HttpRequest, HttpResponse, 
        Future[Http.OutgoingConnection]] =
        Http().outgoingConnection(host = "localhost", port = 8080)

and then

  def httpPost(uri: String, httpEntity:Strict) {
    val responseFuture: Future[HttpResponse] =
      Source.single(HttpRequest(uri = "/monitor", method = HttpMethods.POST, entity=httpEntity))
        .via(connectionFlow)
        .runWith(Sink.head)

    responseFuture onComplete {
      case Success(response) => log.info("Communicated with Server: {}", response)
      case Failure(failure) => log.error("Communication failed with Server: {}", failure)
    }

and this worked for me


You could use Source.queue instead of Source.single to provide buffering and overflow strategy. See more details at https://stackoverflow.com/a/35115314/1699837