Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to invoke async controller logic after returning response using Spring?

I need to process request asynchronously in time - after receiving request I must return a response with status 200 to confirm that the request have reached it's goal, and then proceed with some magic to happen in service. I tried few ways to reach it, but every time response was sent after logic part ended in some other thread.

Is there a way to reach it using Spring? Or should I rather think about other approach to this problem?

like image 655
aldrael Avatar asked May 06 '26 21:05

aldrael


1 Answers

The Spring Framework provides abstractions for asynchronous execution and scheduling of tasks

You can look at this => http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html

like image 82
khanou Avatar answered May 09 '26 09:05

khanou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!