camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@evosent.com>
Subject Re: camel-cxfrs and AsyncResponse
Date Tue, 26 Aug 2014 14:50:53 GMT
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 <Michael.Bannii@evry.com>
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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message