Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Possible to switch from synchronous to asnchronous?

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a spring boot web app, RESTfult webservices implemented. One request could take few minutes to fetch the results and sometimes same request could take 10 mins or more which will result in browser time out if I decided to go with synchronous call in this scenario.

Is it possible to switch from synchronous to asynchronous on the fly?

I would believe NO because I've recently handled asynchronous requests using ActiveMQ which is a different model all together if we compare it with synchronous call.

But then how do we handle the scenario I explained above - where I'm not sure how long a request is going to take?
 
Rancher
Posts: 500
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can put an asyncresponse in the parameter of the controller method and use that.   Problem is that even though the controller isnt blocked you can still time out on the client end.    If it takes 10 minutes then you probably want to find another way to transfer the data.  Even if it's asynchronous it will still take the same amount of time.



Maybe you could use a webs ocker?
 
Sheriff
Posts: 4674
308
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it were me I'd be looking more closely at why it is taking 10 minutes. Do you have an inefficient database query? Are you pulling back a lot of data you don't need?
 
Let me tell you a story about a man named Jed. He made this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!