Comments (6)
It can be helpful: i got like it problem with ReadStream.handler
val resp = req.send(Buffer.buffer(query.body.readAllBytes())).await()
resp.endHandler {
println("CLOSED")
respCh.close()
}
resp.exceptionHandler {
it.printStackTrace()
}
resp.handler {
println(it.getString(0, 10) +"..."+ it.getString(it.length()-10, it.length()))
}
=====START RECEIVE=====
\n purus S...citudin er
os. Donec ...:00:00 AM\
"} ], \"ip...e\": \"app
lication/v...:"^1[./0-9
$","profil...33030]}]}}
CLOSED
But when i remove .await() from send call and use Fututre.onSuccess() - i get normal response all time
req.send(Buffer.buffer(query.body.readAllBytes())).onSuccess { resp ->
resp.endHandler {
println("CLOSED")
}
resp.exceptionHandler {
it.printStackTrace()
}
resp.handler {
println(it.getString(0, 10) +"..."+ it.getString(it.length()-10, it.length()))
}
}
{"took":23...psum primi
s in fauci...","_id":"2
201756-2-0...ue dictum,
efficitur...oncus vari
us. Aenean...uster":"te
st","sub_c...dimentum d
ui rutrum ...tricies, a
t vehicula...,\"connect
ion_data\"..., hendreri
t vestibul...68020]}]}}
CLOSED
from vertx-lang-kotlin.
Experimentally i found solution for my case :
suspend fun Future<HttpClientResponse>.await(): HttpClientResponse = when {
succeeded() -> result().pause() <--- solution
failed() -> throw cause()
else -> suspendCancellableCoroutine { cont: CancellableContinuation<HttpClientResponse> ->
onComplete { asyncResult ->
if (asyncResult.succeeded()) cont.resume(asyncResult.result().pause()) <--- solution
else cont.resumeWithException(asyncResult.cause())
}
}
}
i call HttpClientResponse.pause() immediately after taken the result. Between getting the HttpClientResponse and processing response batches i call HttpClientResponse.statusCode(). Can it invoke reading first batch without any handlers?
from vertx-lang-kotlin.
is there a bug we should fix ?
from vertx-lang-kotlin.
can you provide a reproducer project please ?
from vertx-lang-kotlin.
Hi, sorry, i missed github notification letter. I will prepare reproducer project when i get some free time. But now i think that problem in some specific elasticsearch response details (like a long warning header with text or chunked content-encoding).
from vertx-lang-kotlin.
Please reopen if you can provide a reproducer.
from vertx-lang-kotlin.
Related Issues (20)
- json builder processes binary data differently from JsonObject class HOT 3
- Update to Kotlin 1.5.31
- Provide a vertxFuture coroutine builder HOT 2
- CVE-2021-45105
- CVE-2021-45105
- CVE-2021-45105
- Starting a coroutine on a vert.x worker thread runs it on the same thread but should hand it over to the event loop thread HOT 3
- Upgrade to Kotlin 1.7.21
- Upgrade to Kotlin Coroutines 1.6.4
- Support for Mutiny for CoroutineVerticle for awaitSuspending Support HOT 1
- Add Vert.x core dependency back HOT 1
- Upgrade to 4.4.0 requires stdlib HOT 5
- StackOverflowError caused by two yield calls HOT 4
- Coroutine dispatcher doesn't execute commands on the duplicated context HOT 3
- Coroutine execution always performed with dispatch if the dispatcher is bound to a DuplicatedContext HOT 5
- ChannelWriteStream has a bug closing underlying stream HOT 3
- Add Future.coAwait and deprecate Future.await HOT 1
- Upgrade to Kotlin 1.9
- Kotlin fixes HOT 1
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 vertx-lang-kotlin.