How to implement java background tasks that are time-consuming for front-end requests without timeout?

the business needs a button at the front end, which is clicked and submitted to the background to execute a time-consuming background task, which takes about a few minutes to dozens of minutes, and the front end needs to know the result of the task execution (success, failure, execution).

if you use a normal ajax request, the page will time out because it takes too long.
if you implement the function of submitting a request, polling execution status, and displaying the front end in real time, it will be complicated and unreliable.

are there any ready-made plug-ins or functions that can be implemented? If you implement it on your own, how to do it is more simple and reliable?


can take an asynchronous method, and immediately after the front end invokes, it tells the front end that the task is being processed and that the time-consuming task is an asynchronous method.
can use spring's Async annotations.


polling is fine

  • App background Architecture Design

    prepare to start an app background development. The basic framework is spring, spring mvc, mybatis (write), jdbctemplate (read). in order to deal with the problem of high concurrency in the future, what designs or technologies are best carried out in ...

Menu