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)
- HTTP Connection Pooling May Not Work Properly with Explicitly Configured Client SSL HOT 6
- Client sockets are not re-used when explicit EventLoopGroup is passed HOT 1
- Provide `ConnectionProvider` configuration for limiting the number of the connection pools HOT 6
- Allow to customize the server side processing of request / response decoder errors HOT 2
- Unable to handle http/2 (deprecated) PRIORITY frames HOT 5
- io.projectreactor.netty:reactor-netty-http:1.1.15 unit test cases are failing HOT 6
- Expose activeStreams and potentially pendingStreams for use in ConnectionPoolMetrics in MeterRegistrar HOT 3
- A pooled `ByteBuf` received from the HTTP request should only be released once rather than twice HOT 2
- NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null HOT 2
- io.netty.handler.codec.DefaultHeaders.remove(DefaultHeaders.java 1074) java.lang.NullPointerException : Cannot read field ""hash"" because ""e"" is null HOT 14
- Missing/Wrong classifier in dependency netty-resolver-dns-native-macos HOT 1
- "IllegalReferenceCountException Occurs with HTTP/2 Due to Race Condition Between HttpServerOperation and SimpleCompressionHandler" HOT 17
- Possible memory leak when using pooled connections HOT 20
- Netty HttpClient - Capture / Log time taken for resolving DNS HOT 1
- Data related to the response is being filtered and body is not displayed despite various attempts to set it up HOT 1
- reactor.netty.http.client.PrematureCloseException: Connection has been closed BEFORE response, while sending request body HOT 4
- Netty HttpClient Connection Pool creates connection for every request HOT 7
- Getting timeout exception HOT 3
- Increased latency while calling api using webclient with connection pool HOT 4
- Some request of a webclient instance does not resolve the ip address of hostname correct after it has changed by the dns HOT 8
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.