Hi Michael, Raul

I've created an enhancement request to track this issue.
https://issues.apache.org/jira/browse/CAMEL-7750

I guess few minor tweaks are needed either at Camel CXFRS or CXF JAXRS Invoker level...

Thanks, Sergey
On 26/08/14 17:04, Michael Bannii wrote:
It appears I already have SelectChannelConnector set up in my pom.xml and still 
have the issue...

I use  jetty-maven-plugin 8.1.15.v20140411 with CXF 2.7.11 and Camel v2.13.2.
The processing chain appears to be:  jetty -> some filters -> cxf -> cxfrs -> 
camel.

Also when I set a breakpoint inside my processor I see that a whole HTTP thread 
gets blocked by it (which is probably not what I want, and I want to arrange a 
threadless wait when calling backend in my processor), and in stack there is
    CxfRsInvoker.performInvocation(Exchange, Object, Method, Object[]) line: 56 
and the continuation object there is an instance of 
org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.
 So at least some Continuation is being used.


-----Original Message-----
From: Raul Kripalani [mailto:[email protected]]
Sent: 26 серпня 2014 р. 17:51
To: [email protected]
Subject: Re: camel-cxfrs and AsyncResponse

I came across this issue recently and the culprit was the default etc/jetty.xml 
configuration packaged with Apache ServiceMix, which by default uses the 
BlockingChannelConnector, as explained in the inline XML comment.

This connector does not support Jetty Continuations, therefore it is not 
capable of handling an async response.

You don't specify what runtime container you're using, but if you use Apache 
ServiceMix or Apache Karaf with Pax Web you can be facing the same problem.

If you swap the BlockingChannelConnector for a SelectChannelConnector, it 
should work.

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source 
Integration specialist http://about.me/raulkripalani | 
http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Tue, Aug 26, 2014 at 3:21 PM, Michael Bannii <[email protected]>
wrote:

Hi,

I use camel-cxfrs with a JAX-RS2 resource java class having a method
declared in async way using AsyncResponse, like this:

     <camel:route>
         <camel:from
uri="cxfrs://bean://testRsServer?bindingStyle=SimpleConsumer" />
         .........a code here that finally does
exchange.getOut().setBody(response);
     </camel:route>

     <camelcxf:rsServer id="testRsServer" address="/test"
serviceClass="foo.bar.TestResource">

     @Path("/") @Produces({MediaType.APPLICATION_JSON})
     public class TestResource {
         @POST @Path("/something")
         public void addAccount(@Multipart(value = "myDomainObject")
final String myDomainObject, @Suspended final AsyncResponse ar) {
             throw new RuntimeException("Camel does not call it anyway");
         }
     }


When I invoke the resource, Camel invokes the route, however no REST
response is sent back to client for some reason... Looks like Camel is
not calling AsyncResponse.resume()?

If I change the resource declaration to sync-way like below, i.e. drop
AsyncResponse and change response type from void to MyResponse, then
REST response is sent back as expected.

         @POST @Path("/something")
         public MyResponse addAccount(@Multipart(value =
"myDomainObject") final String myDomainObject) {
             throw new RuntimeException("Camel does not call it anyway");
         }

Why is such behavior? Am I missing something?


--
Best regards



Reply via email to