You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by huntc <hu...@mac.com> on 2010/09/10 06:30:59 UTC

CXFRS consumers - is there a better way?

Hi there,

I've been using the Camel CXFRS component and I have to say that I've found
the learning curve steep. Perhaps this is due to not being familliar with
CXF. Regardless, given my high level of familiarity with Camel and general
experience, implementing a RESTful JSON endpoint was just too hard.

My expectation is that I could express a route for consuming CXFRS requests
using something like this:

from("jetty:http://localhost/").to("cxfrs:consumer?services=#myService1,#myService2");

where my service instances ("#myService1" etc.) are JAX-RS annotated
instances configured in my Spring XML.

All that I want CXF to do is marshall RESTful exchanges into JAX-RS
invocations of beans as I think that this is a good separation of concerns.
Is this possible somehow?

Kidn regards,
Christoppher
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2834502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by huntc <hu...@mac.com>.
Hi Willem,

Just a FYI, I've resolved this issue and provided a patch on the JIRA issue.
Let me know if you think it warrants a test case as I found it pretty
trivial to implement.

Kind regards,
Christopher
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2836101.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by huntc <hu...@mac.com>.
Hi Willem,

Thanks for the response. I've now raised a JIRA at 
https://issues.apache.org/activemq/browse/CAMEL-3117
https://issues.apache.org/activemq/browse/CAMEL-3117 .

Kind regards,
Christopher
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2835851.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by "Willem.Jiang" <wi...@gmail.com>.
Current cxfbeans doesn't support to configure the provider as you do in the
cxf:rsServer.
I think we can introduce some kind of spring configuration to it.
Please feel free to create a JIRA for it.
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2835839.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by huntc <hu...@mac.com>.
OK, previously I specified a provider in the providers element of a
cxf:rsServer element. How do I now specify a provider when using cxfbean? 

This is what I had when using cxfrs:


  &lt;cxf:rsServer id="rsServer"
   
address="http://localhost:${com.classactionpl.gpstrackerservices.httpPort}"
   
serviceClass="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionService"
    staticSubresourceResolution="true"&gt;
    &lt;cxf:providers&gt;
      &lt;bean
       
class="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionProvider"&gt;
        &lt;property name="gpsTrackerCollectionTransformer"
ref="gpsTrackerCollectionTransformer" /&gt;
      &lt;/bean&gt;
    &lt;/cxf:providers&gt;
  &lt;/cxf:rsServer&gt;


...so now that I have the following route declaration, how do I specify the
provider?


  from("jetty:http://localhost:" + httpPort + "?matchOnUriPrefix=true")
        .to("seda:gpsTrackerCollectionWebService");

  from("seda:gpsTrackerCollectionWebService?concurrentConsumers=2").to(
        "cxfbean:gpsTrackerCollectionWebService");


Thanks for your help. I shall update the wiki with the solution you provide.

Kind regards,
Christopher
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2835835.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by huntc <hu...@mac.com>.
Gosh, how did I miss that... I've now updated the non-bean CXF pages of the
Wiki to emphasise the benefits of using the bean component with a short note
at the top of each page.
-- 
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-consumers-is-there-a-better-way-tp2834502p2835789.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXFRS consumers - is there a better way?

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You can take a look at cxfbeans[1], it does the exact thing that you 
want to do.

http://camel.apache.org/cxf-bean-component.html

Willem

On 9/10/10 12:30 PM, huntc wrote:
>
> Hi there,
>
> I've been using the Camel CXFRS component and I have to say that I've found
> the learning curve steep. Perhaps this is due to not being familliar with
> CXF. Regardless, given my high level of familiarity with Camel and general
> experience, implementing a RESTful JSON endpoint was just too hard.
>
> My expectation is that I could express a route for consuming CXFRS requests
> using something like this:
>
> from("jetty:http://localhost/").to("cxfrs:consumer?services=#myService1,#myService2");
>
> where my service instances ("#myService1" etc.) are JAX-RS annotated
> instances configured in my Spring XML.
>
> All that I want CXF to do is marshall RESTful exchanges into JAX-RS
> invocations of beans as I think that this is a good separation of concerns.
> Is this possible somehow?
>
> Kidn regards,
> Christoppher