java - Is there analog of AsyncContext in spring mvc?(how to write http response in another thread) -


i have google spring support of servlet 3.0/3.1 specification , of information have found @ article: understanding callable , spring deferredresult

here author can return callable or defferedresult controller , servlet 3.0/3.1 maintain in spring.

but don't understand how apply in situation:

i have external system , result system asynchrounously.

in controller write this:

externalsystenm.send(requestid, message); 

and have thread result:

message m = externalsystem.get(); m.getrequestid();// according id can map message request 

i know in servlet api allow save asynccontext in map , found it.

how can acheve in spring ?

i have found following article: spring mvc 3.2 preview: introducing servlet 3, async support

example:

@requestmapping("/quotes") @responsebody public deferredresult<string> quotes() {   deferredresult<string> deferredresult = new deferredresult<string>();   // add deferredresult queue or map...   return deferredresult; }   // in other thread...    <-- important phrase  deferredresult.setresult(data); // remove deferredresult queue or map 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -