Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: Long processing results in Data Adapter timeout

$
0
0

There is a resolution, but it is quite complex.

In brief the idea is to implement a mechanism similar to the tasks:

 

1) data adapter should return data object like this:

 

pubic class MyResultWrapper {   public String requestId;  public int progress;  // if you can report one   public MyResult result;  // the real result object; will be null, until progress = 100
}

 

2) the first time you query for data, the data adapter start asynchronous processing and returns request id immediately

You should use Spring executor/thread pool like org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor and set WaitForTasksToCompleteOnShutdown=false

It is important to make sure that you use small number of threads; to enqueue the requests and to shutdown the threads on server shutdown to prevent leaks.

Note that using thread pools in the plugins is strongly discouraged. It is preferred to move this logic to your own backend server.

 

3) the UI starts polling over some period of time passing the same request id in the QuerySpec (either in the "name" property of in the "options" map)

4) Once the result is ready, send it using MyResultWrapper#result


Viewing all articles
Browse latest Browse all 168455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>