我試圖在後端調用中實現異步,我一直在閱讀,似乎GParse是一個很好的庫來實現這一點,但它並不清楚我如何可以在一個正確的方式。誰能幫我?這是我的例子:GParse call BackendService async
def itemsResults
def locationResults
def itemsNearLocation
GParsPool.withPool {
itemsResults = {searchMyItems()}.async().call()
locationResults = {getLocations()}.async().call()
itemsNearLocation = {getItemsNear(locationResults)}.async().call() // i need locationresults answer in order to call this service
}
model.putAll(["items": itemsResults,
"itemsNearLocation":itemsNearLocation])
return "myView"
所以,我需要調用的API 2呼叫,然後在第三個我需要使用所謂的異步前的反應之一,並最終加入到我的模型。我怎樣才能做到這一點?
可能是[數據流(HTTP一個很好的例子:// WWW。 gpars.org/1.0.0/guide/guide/dataflow.html) –