简体   繁体   中英

Making Async AJAX calls Synchronous

Environment: Ext-JS Frontend UI -> AJAX Calls -> Spring MVC Server/Java -> Apache CXF to MQ -> Back-end COBOL.

Based on the above environment we can not handle asynchronous AJAX calls being sent due to a limitation with the backend COBOL server. Normally we daisy chain our ajax calls. However now we need an automatic refresh mechanism on some UI pages. So if we happen to send a normal AJAX request from the UI at the same time as a refresh (AJAX) calls gets dispatched then we need to queue the two calls and make them effectively Synchronous. Any solution would need to be generic though.

What would be the simplest way of dealing with this scenario ? Is there a simple approach of blocking the refresh call when a request has already been dispatched? Or would it be best to use an ExecutorService in the Java Server layer to handle the scenario ? Or maybe futures/promises. How would I make that work ?

Hope this make sense and any suggestions on an approach would be appreciated.

您是否考虑过使用像Beanstalkd这样的排队系统,流程如下:

Ext-JS Frontend UI -> AJAX Calls -> Spring MVC Server/Java -> Beanstalkd -> Apache CXF to MQ -> Back-end COBOL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM