Comments (5)
@nebhale do you have a more specific use-case? As you said, the Mono<HttpClientResponse>
does indeed complete based on the reception of the response headers, aka the request has been done.
There are several caveats that make your feature request impractical. Most notably, waiting for the receiveContent()
to complete before emitting the response would make the body of the response unusable:
- the
FluxReceiver
willrelease()
http content as it is emitted - it only allows one subscription
So the idiomatic way of working with the response would be to flatMap
to receiveContent()
and deal with the content (before it is released).
That said, if you're only interested in the headers or status code, but you only want to evaluate those once the response has completed, you could now use delayUntil(HttpClientResponse::receiveContent)
.
How does that sound? Do you feel there's really a need for a deeper cross-cutting change in the behavior and design of FluxReceiver
?
from reactor-netty.
@simonbasle I don't believe that the receiveContent()
hook is sufficient, as it puts you in a situation where you cannot generically handle the end of a response. If you take a look at AbstractReactorOperations
we want to be able to time how long a request and response pair takes.
At the moment, it's wrong on both ends. We can only intercept the onSubscribe
, not when the first byte of the request goes out. So you could imagine a chain of multiple requests each using data from the previous request. The timer on the final one starts long before it actually sends a request. Then at the other end, we can only generically intercept the finish of the response, not when all of the data is actually complete. As you can see in that class, it's a generic base class that is supposed to remove all of the "standard" logging, error handling, etc. But since we hand back the Mono<HttpClientResponse>
back to the caller, potentially before any .receive*
is called, we can't intercept that late and still have all the appropriate timing context. It also would break the the point of the class that it handles a bunch of "standard" behavior so the thousands of other users don't have to.
from reactor-netty.
๐ค just a wild thought: for the purpose of this kind of measurements, closer to the wire, I wonder if a workaround could be to add a special netty handler to the pipeline that does the timings. Did you explore that solution by any chance?
from reactor-netty.
I did not because I'm a reactor-netty
user, not a Netty user ๐. It means that I have to drop to a non-blocking, but non-reactive API which seems onerous for a reactor-netty
user. I chose to use a higher-level API in part because I didn't want to write to Netty's API. I find Reactor so much better and easier to use, that something as simple as intercepting first and last byte shouldn't require abandoning it.
from reactor-netty.
@nebhale @simonbasle I believe this can be achieved with the lifecycle callbacks.
https://projectreactor.io/docs/netty/snapshot/reference/index.html#_lifecycle_callbacks_4
from reactor-netty.
Related Issues (20)
- Support For Spnego Auth scheme support for netty HttpClient similar to Apache's HOT 3
- HTTP/1.1 is being logged and recorded by metrics even though HTTP/2 is enabled HOT 10
- proxy-authorization header is not propagated to proxy server HOT 9
- Support for Spengo auth scheme support for netty HttpClient similar to Apache HttpClient HOT 2
- Spring Cloud Gateway use reactor netty ๏ผResponse header and response body packet capture were found to be separate HOT 1
- CompletableFuture is cancelled because Netty is closing the connection channel HOT 5
- WebSockets - MaxFramePayloadLength behaviour when using WebSocketServerSpec.compress(true) HOT 2
- Timeout leaves connection in the pool in configured state, blocking a pool slot HOT 17
- ERROR io.netty.util.ResourceLeakDetector - LEAK: ByteBuf.release() was not called before it's garbage-collected. HOT 3
- HTTP2 Client doesn't work/DefaultChannelPipeline wrongly configure for HTTP2 HOT 2
- Connection reset by peer; nested exception is io.netty.channel.unix.Errors$NativeIoException: readAddress(..) HOT 2
- springcloud gateway netty pool config HOT 1
- LEAK: ByteBuf.release() was not called before it's garbage-collected. HOT 17
- ClassNotFoundException for HttpDecoderConfig using reactor-netty-http HOT 3
- Mutable NewConnectionProvider HOT 10
- ByteBuf LEAK when PoolAcquirePendingLimitException is thrown HOT 9
- Consistent Memory Increase in Webflux Application HOT 5
- Build should not depend on `doc:antora`
- Ongoing connection reset by peer HOT 6
- Memory Leak in reactor-netty when using Spring WebClient with blocked flux. Issue: Databuffer is not released. HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactor-netty.