electronicarts / ea-async

EA Async implements async-await methods in the JVM.

Home Page:https://go.ea.com/ea-async

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use ea-sync in spring boot

hufuman opened this issue · comments

commented

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.

commented

Thank JoeHegarty, I'll have a try.

commented

It's ok, many thanks.