The problem of SpringMVC real-time monitoring service execution progress

problem description:
the front end invokes a service An at the back end, and
this service A contains the sub-service BMagne C * C * C has its own independent transaction mechanism and does not affect each other. After
is executed, the final return front end is a result processed by BeneC.
there is a requirement that when I finish executing service B, is there any way for the front end to receive a message like "B has finished execution, C service is executing" without affecting the final return result.
or, within the framework of SpringMVC, is there a way for the front end to know the progress of the execution of the service it invokes?
Please don"t hesitate to give us advice and answers.

Mar.01,2021

A feasible solution that has been practiced in work:

  1. backend record status (for example, it can be persisted to the database, there is a field called status ), and status indicates the stage of execution, for example, after the B transaction is completed, set this field to B li C transaction, and set this field to C
  2. .
  3. the front end sends a request for training the back end every once in a while (the polling interval is determined according to the timeliness requirement. Before a bidding system is made, the polling interval of the front end is 3 seconds). The back end returns the status field in the database, that is, status , and the front end can know which stage it is currently performing
  4. .

if you think this scheme is not very elegant, you can consider websocket

.

agrees that
one is to use rotational training. The client constantly queries the server about the current progress
has been using persistent connections. When the progress changes, the server will take the initiative to notify the client

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bd4942-30f18.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bd4942-30f18.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?