#Async requests
1 messages · Page 1 of 1 (latest)
okhttp is ok?
HttpClient built in in Java
declaration: module: java.net.http, package: java.net.http, class: HttpClient
No need for third party dependencies
does webclient make sense?
i fmy project uses spring
if you have spring webclient is also fine, but I don't know if you need webflux for that
depends on the setup/java version/ virtual threads or not
i use java 21
mvc?
yeah java 21 spring boot mvc
If you’re running on Java 21 or up, you can enable virtual threads by setting the property spring.threads.virtual.enabled to true.
And then just use RestTemplate
It doesn't block main thread anymore then
but generally am i set also with webflux client?
webflux on java 21 with virtual threads is just a bad idea
It overcomplicates things for no reason
but do i need to enable them?
I told you right here
Is your problem "blocking the main thread", or is it "I want to run multiple requests in parallel"
i have api
Yes
just wanna be able to make this requests work in parallel
its kind of assesment
for job
and requirements are java 21
so im trying to think how to do it in most optimal way
I'd use Virtual Threads then
Its like calling 1 api endpoint filtering it calling another api and thats it i think
are they then still a thing?
ah it's not in parallel then
That's serial
call one, results, call other with results of first
Yeah i was thinking more like another request coming
while the previous one is still being processed
ok wtf are you doing, because now you're talking about an api you are implementing
And just now it was a client
can u look at pv?