How to use ea-sync in spring boot
hufuman opened this issue · comments
Hi, thanks for great jobs!
I tried this in spring boot service, I found that await works like sync function to service, am I right ?
consider codes:
`
@ResponseBody()
@PostMapping("query.do")
public QueryResult query(@RequestParam int pageNum) {
QueryResult result = new QueryResult(); <1>
result.setResult(await(queryResult(pageNum))); <2>
return result; <3>
}
`
In fact, this function only return after <2> queryResult is done?
I'm not super familiar with spring boot, but is QueryResult derived from CompletionStage/CompletableFuture?
EA async instrumented methods must return and can only await on CompletionStage derived futures currently.
Thank JoeHegarty, I'll have a try.
It's ok, many thanks.