Hi Andrei

On 11/02/14 09:03, Andrei Shakirin wrote:
Hi,

AFAIK you can benefit from Servlet async API by using AsyncResponse argument:

@Path("/say")
public class HelloWorldResource {

     @GET
     @Produces("text/plain")
     public void helloWorld(AsyncResponse asyncResponse) {
         asyncResponse.setTimeout(1000, TimeUnit.MILLISECONDS);
         asyncResponse.setTimeoutHandler(new TimeoutHandler() {
             public void handleTimeout(AsyncResponse ar) {
                 ar.resume("timeout");
             }
         });
     }
}

See the following thread for details: 
http://cxf.547215.n5.nabble.com/CXFServlet-Asynchronous-JAX-RS-server-Tomcat-7-tt5718143.html#none

Thanks for this hint, yes, this is one way how one can interact with it using JAX-RS 2.0 API, see also
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java

and some basic info here:

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Basics

which links to the page describing CXF Continuations API


Sergei, is @UseAsyncMethod annotation already supported for JAX-RS endpoints?
Not yet, I have a JIRA for it but has not got to implementing it yet

Thanks, Sergey

Regards,
Andrei.

-----Original Message-----
From: Bhupesh Tuteja [mailto:[email protected]]
Sent: Dienstag, 11. Februar 2014 07:49
To: [email protected]
Subject: Server Side Asynchronous processing support via CXF & NIO support

Hi CXF developers,

I have been using CXF 2.7.7 and exposing my service using JAXRS support
provided by CXF.

         <jaxrs:server address="/" id="appService">

                 <jaxrs:serviceBeans>
                         <ref bean="productOffersService" />
                 </jaxrs:serviceBeans>

                 <jaxrs:providers>
                         <ref bean="provider" />
                         <ref bean="exceptionMapper" />
                 </jaxrs:providers>
         </jaxrs:server>

Recently I have been reading about asynchronous processing support in Servlet
3.0 http://docs.oracle.com/javaee/7/tutorial/doc/servlets012.htm

I am wondering how do I utilize this in my code as i am not dealing with
HttpServletRequest and HttpServletResponse directly. Are there any examples?

On the other hand, my service is also I/O bound and acts as an orchestrator.
It is again using JAXRS support of CXF to invoke REST services. Need suggestion
on how to get benefit from non-blocking IO and how extensively CXF supports
NIO. Are there any examples?



--
View this message in context: http://cxf.547215.n5.nabble.com/Server-Side-
Asynchronous-processing-support-via-CXF-NIO-support-tp5739791.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to