https://kotlinlang.org logo
#spring
Title
# spring
b

bjonnh

10/22/2019, 7:34 PM
I have an architecture question. Is there a spring-friendly approach for triggering long-running tasks? (through http for example). I would like to be able to query if that task is still running, failed, etc
I see that we have Async so that would solve the asynchronous aspect of the question. But what about status of the task, making sure it runs with a concurrency of 1 etc. And is there a way to do that for an unlimited amount of tasks (queuing them and having concurrency if wanted).
m

Matheus

10/22/2019, 8:03 PM
You can set up a Threadpool to execute Async tasks,
then another endpoint (JMX?) to query the status of the threadpool
If you create a qualified
ThreadpoolTaskExecutor
bean, you can use the
@Async(<<qualifier here>>)
on your background method to use it
b

bjonnh

10/22/2019, 8:27 PM
So there is no higher level of abstraction
ok
m

Matheus

10/22/2019, 8:32 PM
not that i know of
b

bjonnh

10/22/2019, 9:13 PM
thanks!
3 Views