I want to capture this exception in my application, but It cannot be capturued using CompletionStage<HttpResponse>.exceptionally().
final HttpRequest request = HttpRequest.create(uri).addHeader(range) ;
final CompletionStage<HttpResponse> responseFuture =
Http.get(system)
.singleRequest(request, materializer);
responseFuture.exceptionally(ex -> {
failed(chunk, ex);
return null ;
}) ;
[error] a.a.ActorSystemImpl - Outgoing request stream error
akka.http.scaladsl.model.EntityStreamException: Entity stream truncation
at akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$defaultEntity$1$$anonfun$1.applyOrElse(HttpMessageParser.scala:344)
at akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$defaultEntity$1$$anonfun$1.applyOrElse(HttpMessageParser.scala:342)
at akka.stream.impl.fusing.Collect$$anon$2$$anonfun$4.apply(Ops.scala:175)
at akka.stream.impl.fusing.SupervisedGraphStageLogic.withSupervision(Ops.scala:142)
at akka.stream.impl.fusing.Collect$$anon$2.onPush(Ops.scala:177)
at akka.stream.impl.fusing.GraphInterpreter.processElement$1(GraphInterpreter.scala:590)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:601)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:542)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:471)
at akka.stream.impl.fusing.GraphInterpreterShell.receive(ActorGraphInterpreter.scala:423)
[info] a.a.LocalActorRef - Message [akka.http.impl.engine.client.PoolInterfaceActor$PoolRequest] from Actor[akka://application/user/pool-master#-922799551] to Actor[akka://application/user/pool-master/PoolInterfaceActor-0#1525660917] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[info] a.a.LocalActorRef - Message [akka.http.impl.engine.client.PoolInterfaceActor$PoolRequest] from Actor[akka://application/user/pool-master#-922799551] to Actor[akka://application/user/pool-master/PoolInterfaceActor-0#1525660917] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[error] a.h.i.e.c.PoolMasterActor - connection pool for PoolGateway(hcps = HostConnectionPoolSetup(
runner.dressbad.com,80,ConnectionPoolSetup(ConnectionPoolSettings(4,0,5,32,1,30 seconds,ClientConnectionSettings(Some(User-Agent: akka-http/2.4.8),10 seconds,1 minute,512,<function0>,List(),ParserSettings(2048,16,64,64,8192,64,8388608,256,1048576,Strict,RFC6265,true,Full,Map(If-Range -> 0, If-Modified-Since -> 0, If-Unmodified-Since -> 0, default -> 12, Content-MD5 -> 0, Date -> 0, If-Match -> 0, If-None-Match -> 0, User-Agent -> 32),false,<function1>,<function1>,<function2>))),akka.http.scaladsl.HttpConnectionContext$@7994f4f8,akka.event.BusLogging@421bed04))) has shut down unexpectedly
When the exception occurred, my application hung up because my application cannot capture the exception so that it cannot recover from it.
Thanks for your help very much.
I use Akka 2.4.8, Java 8.