Quantcast

Apache Camel : CXFRS Server : Need advice for Routing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Apache Camel : CXFRS Server : Need advice for Routing

anand_tech
i am making restful webservices using apache cxf and camel. my configuration is something like this :

    <camelcxf:rsServer id="applicationserver" address="/" staticSubresourceResolution="true">
    <camelcxf:serviceBeans>
    <ref bean="Demo" />
    <ref bean="Foo" />
    <ref bean="Bar" />
    </camelcxf:serviceBeans>
    </camelcxf:rsServer>
I have three service beans exposed as services and are mapped to different urls and the route is something like this :

    <camel:route id="ServerRoute">
    <camel:from uri="cxfrs://bean://applicationserver" />                       
    <camel:process ref="camelCxfInProcessor" />
    <camel:to uri="http://google" />
    <camel:to uri="bean:googlereqreshandler" />

Now for each service bean i want to have different route as all three have different functionality, but i am unable to determine what should i write in my  

    <from: uri="cxfrs://bean://aplicationserver..."/> 

tag to distinguish routes according to service beans. Or is there any other way of doing this?  please suggest something.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Apache Camel : CXFRS Server : Need advice for Routing

Sergey Beryozkin-3
Hi
On 10/05/12 07:47, anand_tech wrote:

> i am making restful webservices using apache cxf and camel. my configuration
> is something like this :
>
>      <camelcxf:rsServer id="applicationserver" address="/"
> staticSubresourceResolution="true">
>      <camelcxf:serviceBeans>
>      <ref bean="Demo" />
>      <ref bean="Foo" />
>      <ref bean="Bar" />
>      </camelcxf:serviceBeans>
>      </camelcxf:rsServer>
> I have three service beans exposed as services and are mapped to different
> urls and the route is something like this :
>
>      <camel:route id="ServerRoute">
>      <camel:from uri="cxfrs://bean://applicationserver" />
>      <camel:process ref="camelCxfInProcessor" />
>      <camel:to uri="http://google" />
>      <camel:to uri="bean:googlereqreshandler" />
>
> Now for each service bean i want to have different route as all three have
> different functionality, but i am unable to determine what should i write in
> my
>
>      <from: uri="cxfrs://bean://aplicationserver..."/>
>
> tag to distinguish routes according to service beans. Or is there any other
> way of doing this?  please suggest something.
>
Perhaps it would be simpler to create 3 cxfrs endpoints with unique ids,
one linking to Demo, etc ? Example,

<camelcxf:rsServer id="demoServer" address="/demo"
  staticSubresourceResolution="true">
       <camelcxf:serviceBeans>
         <ref bean="Demo" />
       </camelcxf:serviceBeans>
</camelcxf:rsServer>

with the @Path annotation on the Demo root resource now containing "/"
and rsServer/@address assuming the "/demo" value, etc ?

Sergey

>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-CXFRS-Server-Need-advice-for-Routing-tp5699287.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Apache Camel : CXFRS Server : Need advice for Routing

Willem.Jiang
In reply to this post by anand_tech
Hi,

I'm not sure if these three beans have same method name.
As the REST request will be mapped into a method call, if you check the
method name in the camelCxfInProcessor, you should be able to tell the
request is coming for which bean. It should be easy to route the request
to different endpoint.

Any thought ?

On 5/10/12 2:47 PM, anand_tech wrote:

> i am making restful webservices using apache cxf and camel. my configuration
> is something like this :
>
>      <camelcxf:rsServer id="applicationserver" address="/"
> staticSubresourceResolution="true">
>      <camelcxf:serviceBeans>
>      <ref bean="Demo" />
>      <ref bean="Foo" />
>      <ref bean="Bar" />
>      </camelcxf:serviceBeans>
>      </camelcxf:rsServer>
> I have three service beans exposed as services and are mapped to different
> urls and the route is something like this :
>
>      <camel:route id="ServerRoute">
>      <camel:from uri="cxfrs://bean://applicationserver" />
>      <camel:process ref="camelCxfInProcessor" />
>      <camel:to uri="http://google" />
>      <camel:to uri="bean:googlereqreshandler" />
>
> Now for each service bean i want to have different route as all three have
> different functionality, but i am unable to determine what should i write in
> my
>
>      <from: uri="cxfrs://bean://aplicationserver..."/>
>
> tag to distinguish routes according to service beans. Or is there any other
> way of doing this?  please suggest something.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-CXFRS-Server-Need-advice-for-Routing-tp5699287.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> .
>


--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Apache Camel : CXFRS Server : Need advice for Routing

anand_tech
Thanks Willem..

 i actually was using something like that only, i had used  sort of content based router, i.e. the choice and when clause and routing on the basis of url and Http Method being hit. i was just wondering whether i can make different endpoints for my service beans and as correctly pointed out by Sergey i am following that now.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Apache Camel : CXFRS Server : Need advice for Routing

Willem.Jiang
Sergey shows you the way that CXF does.
But if you want to route more than one cxfrs endpoint you may consider
to use camel-jetty or camel-servlet to do such thing in generic way.

On Sun May 13 23:42:23 2012, anand_tech wrote:

> Thanks Willem..
>
>   i actually was using something like that only, i had used  sort of content
> based router, i.e. the choice and when clause and routing on the basis of
> url and Http Method being hit. i was just wondering whether i can make
> different endpoints for my service beans and as correctly pointed out by
> Sergey i am following that now.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-CXFRS-Server-Need-advice-for-Routing-tp5699287p5708242.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Loading...