I am getting behavior that I do not understand combining
Http().superPool() with MergeHub.source. Here is a sample application
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpRequest, Uri}
import akka.stream.{ActorMaterializer, ThrottleMode}
import akka.stream.scaladsl.{MergeHub, Sink, Source}
import com.typesafe.config.ConfigFactory
import scala.concurrent.duration._
object Main extends App {
val config = ConfigFactory.load()
implicit val system = ActorSystem("test-system", config)
implicit val executionContext = system.dispatcher
implicit val materializer = ActorMaterializer()
val request = HttpRequest(uri = Uri("http://www.google.com"))
val sink = MergeHub.source[(HttpRequest, Int)]
.throttle(1, 1.second, 1, ThrottleMode.shaping)
.map { x =>
println(s"started ${x._2}")
x
}
.via(Http().superPool())
.to(Sink.foreach { x =>
println(s"finished ${x._2}")
}).run()
for (x <- 1 to 100) sink.runWith(Source.single(request -> x))
}
The output of which is
started 2
finished 2
started 3
finished 3
started 4
finished 4
started 1
finished 1
started 5
started 6
started 7
started 8
My understanding from the documentation is that Http().superPool() will
backpressure. However, after 8 iterations, nothing else happens. Thoughts?
Thanks
Jeff
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.