Hi,
I am completing one of my routes with an entity created from a Source<ByteString,M>
as follows:
HttpResponse.create().withEntity(HttpEntities.create(TEXT_CSV_UTF8, mysource));
Since this source does I/O, it may fail both during materialization and while running. I haven’t observed the latter yet, but a failure during materialization:
- makes the server close the connection after the headers have been sent to the client - this is the behaviour I would expect
- does not log anything as far as I can see - this seems slightly unexpected.
Most importantly, all result transformation directives and exception handlers have already been applied at this point, so I have no natural point where I could catch this problem and do some server-side reporting/recovery. (It’s clear to me that I cannot do anything to help the client at this point, the headers are already sent so the damage is done.)
Is there a way to get something, for example a CompletableFuture
, from the API, that would allow me to check whether mysource
and the entire “response body builder graph” have completed normally or exceptionally?