THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Wiki Markup |
---|
{span:style=font-size:2em;font-weight:bold} Continuations {span} {toc} h1. Continuations API CXF usesoffers Continuations API to manage asynchronous (suspended) invocations over HTTP and JMS Transports. // In progress . [ContinuationProvider|http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java] represents a transport capable of suspending and resuming the invocations on request. CXF offers Servlet3 and legacy Jetty Continuations HTTP as well as JMS ContinuationProvider implementations. ContinuationProvider can be used to get [Continuation|http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/Continuation.java] which represent a current active or suspended invocation. The provider and continuations can be obtained from the current CXF message like this: {code:java} import org.apache.cxf.continuations.ContinuationProvider; import org.apache.cxf.continuations.Continuation; ContinuationProvider provider = (ContinuationProvider)message.get(ContinuationProvider.class.getName()) Continuation continuation = (Continuation)provider.getContinuation(); {code} The continuation can be suspended and resumed. Calling Continuation.suspend() and returning from the current method/code is enough to get CXF suspending the request. Additionally throwing [SuspendedInvocationException|http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java] was required originally but is no longer required/recommended. Resuming the continuation will get the suspended thread returning, this is typically done by a thread which has completed an asynchronous task. Advanced applications can register [ContinuationCallback|http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/ContinuationCallback.java] with the current exchange in order to get the notifications that a given Continuation has completed its work by returning the data to the client. The custom applications can interact directly with Continuations API. CXF also offers higher-level support for asynchronous invocations built on top of Continuations API. h1. UseAsyncMethod JAX-WS frontend supports this annotation, please check the [CXF Annotations|http://cxf.apache.org/docs/annotations.html] page for more information. h2. JAX-RS 2.0 AsyncResponse JAX-RS 2.0 AsyncResponse is implemented in terms of Continuations API. Please see [this section|http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Suspendedinvocations] for more information. h1. Suspending the invocations from the CXF interceptors Advanced custom CXF interceptors can suspend the incoming requests and resume them when needed. Example: {code:java} //TODO {code} |