Comments (9)
@violetagg Thanks for the reply. I'll try to update the code as suggested by you.
from reactor-netty.
@Akshay-Sundarraj You should always defer the creation of the buffers. Something like this:
static Mono<String> execute(HttpClient httpClient, String uri) {
return Mono.defer(() -> {
return Mono.defer(() -> {
return httpClient.request(HttpMethod.POST)
.uri(uri)
.send((httpClientRequest, nettyOutbound) -> {
return nettyOutbound.send(Mono.create(sink -> {
ByteBuf buffer = ByteBufAllocator.DEFAULT.directBuffer();
buffer.writeBytes("Hello World".getBytes(StandardCharsets.UTF_8));
sink.success(buffer);
}));
}).responseSingle(((response, byteBufMono) -> {
return byteBufMono.asString();
}));
}).doFinally(signalType -> {
});
});
}
from reactor-netty.
@violetagg Thanks for the suggestion. The thing is I need to fill the buffer with some binary values based on some binary protocol somewhere else and filling the buffer(serialising some objects) may throw errors. Basically buffer is created and filled in some other part. Is there any way I can handle this?
from reactor-netty.
@Akshay-Sundarraj I cannot help with creating the reactive pipeline as I do not know your project.
from reactor-netty.
@violetagg My question is reactor netty release buffer in some cases and does not release is some other cases. How can I know in what scenarios it doesn't relases?
from reactor-netty.
@Akshay-Sundarraj If we receive the buffer we will definitely release it, however here the HttpClient doesn't start sending at all as it cannot obtain a connection from the pool. That said the buffer consumption is lazy, we will not obtain the buffer as a first step. As a first step we need a connection that will be used for sending the request. Because of that you have to create the buffer only if there is a subscriber that will consume it, while now you create the buffer always regardless whether there is a subscriber or not.
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
- 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.