eclipse-vertx / eclipse-vertx/vert.x
Virtual thread not being used while using verticle deployed as ThreadingModel.VIRTUAL_THREAD in vertx httpclient
- Dominant language
- Java
- Stars
- 14.7k
- Forks
- 2.1k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 27
Description
### Version
5.0.5
### Context
When I use vertx threading model as eventloop or worker while using vertx httpclient, the callbacks are properly coming back on eventloop or worker respectively. However, when I use threading model as virtual thread, the callback are on event loop.
### Steps to reproduce
Deploy a verticle with threading model as virtual thread and create a httpclient in the start/constructor method. Enable the log statements in code below to check the threads on which callback is happening.
Sample code:
```
//log.info("Thread name: {}", Thread.currentThread().getName());
httpClient
.request(requestToBeSent.requestOptions())
.compose(httpClientRequest -> {
//log.info("Compose thread name: {}", Thread.currentThread().getName());
if (requestToBeSent.body() == null) {
return httpClientRequest.send();
} else {
return httpClientRequest.send(requestToBeSent.body());
}
})
.onComplete(httpResponse -> {
//log.info("Complete thread name: {}", Thread.currentThread().getName());
if (httpResponse.failed() && httpResponse.cause() != null) {
log.error("Issue while getting the response after sending the request.", httpResponse.cause());
}
});
```
### Do you have a reproducer?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.