cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to implement the behavior like Promise.all() with javascript service ?

seanccc
17-Peridot

How to implement the behavior like Promise.all() with javascript service ?

Hi,

 

In my case, I need to list 20 entries per page in the mashup.  one of column of the entry need to request data from external system(WMS) using RESTful call.   The performance must will be bad if send 20 requests one by one ,  so I want to send the 20 requests together in parallel and then fill the result when all of the request get finished ,  the similar mechanism like Promise.all()  . 

 

one possible approach may be : 

  • define a session variable as the indicator of finishing all request
  • send the requests asynchronously
  • raise event in each request when get finished
  • the event subscription update the session variable 
  • the main program check session variable in a while loop to know if all of the request get finished

but Is there a more concise solution for the case ? 

 

Regards,

Sean

ACCEPTED SOLUTION

Accepted Solutions

Hello @seanccc,

 

Ideally you don't want to do "# of rows parallel requests". 

Ideally you do parallel requests which each request data for a chunk of rows -- with the chunk size adjusted based on other constraints.

View solution in original post

2 REPLIES 2

Hello @seanccc,

 

Ideally you don't want to do "# of rows parallel requests". 

Ideally you do parallel requests which each request data for a chunk of rows -- with the chunk size adjusted based on other constraints.

slangley
23-Emerald II
(To:seanccc)

Hi @seanccc.

 

If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags