camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: CXF - camel CXF
Date Tue, 01 Dec 2009 08:46:34 GMT
Hi Willem,

To come back to REST implementation between Camel - CXF, can you tell me why
we cannot do the same thing (RESTfull services) that we can do for CXF web
service ?

Here is the camel route that I use in my camel osgi tutorial (part2)

        <camel:route>
            <camel:from uri="cxf:bean:reportIncident" />
            <camel:setHeader headerName="origin">
                <camel:constant>webservice</camel:constant>
            </camel:setHeader>
            <camel:convertBodyTo
type="org.apache.camel.example.reportincident.InputReportIncident" />
            <camel:to uri="bean:webservice" />
            <camel:inOnly uri="queuingservice:queue:in" />
            <camel:transform>
                <camel:method bean="feedback" method="setOk" />
            </camel:transform>

        </camel:route>

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Tue, Dec 1, 2009 at 3:41 AM, Willem Jiang <willem.jiang@gmail.com> wrote:

> Hi Charles,
>
> It really dependents on your use case.
>
> Here is an user case, if have bunch of back end (jaxrs:server) services,
> and you want to do a content based routing, you can user setup a camel
> cxfrsServer and let the client access this server. Then camel route will
>  take care rest of things :)
>
>
> Willem
>
> Charles Moulliard wrote:
>
>> If it makes no sense to use rsServer and rsClient both together in a camel
>> route, what is the advantage to use a camel cxfrsServer endpoint over the
>> jaxrs:server endpoint ?
>>
>> Regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>> On Mon, Nov 30, 2009 at 4:26 PM, Willem Jiang <willem.jiang@gmail.com
>> >wrote:
>>
>>  Oh, this test case just show how camel-cxfrs consumer and camel-cxfrs
>>> producer work together.
>>>
>>> It is not easy to write a bunch of tests to verify a camel-cxfrs consumer
>>> can response different request in a short time, so why not we create  a
>>> camel-cxfrs route in Camel to test the consumer and producer at the same
>>> time.
>>>
>>> Willem
>>>
>>>
>>> Charles Moulliard wrote:
>>>
>>>  If you recommend to call directly the service from the POJO where we
>>>> have
>>>> added REST annotation, what is the purpose of this route presented as an
>>>> example in camel-cxf test if the cxf:rsServer:bean:server endpoint can
>>>> directly answer to a GET/PUT,POST, ... call ?
>>>>
>>>> <route>
>>>> <cxf:rsServer:bean:server/>
>>>> <cxf:rsClient:bean:client/>
>>>> </route>
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>> Senior Enterprise Architect
>>>> Apache Camel Committer
>>>>
>>>> *****************************
>>>> blog : http://cmoulliard.blogspot.com
>>>> twitter : http://twitter.com/cmoulliard
>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>
>>>> Apache Camel Group :
>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>
>>>>
>>>> On Mon, Nov 30, 2009 at 3:53 PM, Willem Jiang <willem.jiang@gmail.com
>>>>
>>>>> wrote:
>>>>>
>>>>  Hi Charles,
>>>>
>>>>> You don't need to use the camel cxfrs route all the time, if you have
>>>>> to
>>>>>  retrieve the DB for the REST request.
>>>>>
>>>>> You just need to define a POJO with annotation, and use OR mapping
>>>>> framework to implement retrieve or update the data for your service.
>>>>> You
>>>>> don't need to let camel be involved ;)
>>>>>
>>>>> Willem
>>>>>
>>>>>
>>>>>
>>>>> Charles Moulliard wrote:
>>>>>
>>>>>  Hi,
>>>>>
>>>>>> If camel is used in combination with CXF to handle REST services,
How
>>>>>> must
>>>>>> be designed the POJOs managing the REST services ?
>>>>>>
>>>>>> eg. camel spring config
>>>>>>
>>>>>>  <cxf:rsServer id="rsServer" address="/camel-rest-example/"
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> serviceClass="org.apache.camel.example.reportincident.restful.ReportIncidentService"
>>>>>> />
>>>>>>
>>>>>>  <cxf:rsClient id="rsClient" address="http://localhost:8181/cxf/http/
>>>>>> "
>>>>>> />
>>>>>>
>>>>>>  <camel:camelContext trace="true"
>>>>>>      xmlns="http://camel.apache.org/schema/osgi">
>>>>>>
>>>>>>      <camel:route>
>>>>>>          <camel:from uri="cxfrs:bean:rsServer" /> // REST HTTP
Service
>>>>>> receiving the call from REST client and providing reply
>>>>>>          <camel:bean ref="service" method="getCustomer" />
>>>>>>          <camel:to uri="activemq:queue:IN"/>
>>>>>>      </camel:route>
>>>>>>
>>>>>>     <camel:route>
>>>>>>          <camel:from uri="activemq:queue:IN" />
>>>>>>          <camel:to uri="cxfrs:bean:rsClient" /> // HTTP (internal
>>>>>> client)
>>>>>> who will generate HTTP reply using CXF - jaxrs:server component to
>>>>>> cxfrs:bean:rsServer endpoint
>>>>>>      </camel:route>
>>>>>>
>>>>>> Do we have to create two POJOs (one for the request and the other
for
>>>>>> the
>>>>>> reply ?
>>>>>> If this is the case, how the method must be defined to provide the
>>>>>> REST
>>>>>> info
>>>>>> (request, parameters, ...) to the camel endpoint (= camel bean) who
>>>>>> will
>>>>>> be
>>>>>> in charge to retrieve by example info from DB ? idem but for the
>>>>>> method
>>>>>> who
>>>>>> will be send back the reply to the client calling the REST service
?
>>>>>>
>>>>>> ex : Request
>>>>>>
>>>>>>  @GET
>>>>>>  @Path("/customers/{id}/")
>>>>>>  public String getCustomer(@PathParam("id") String id) {
>>>>>>      return id;
>>>>>>  }
>>>>>>
>>>>>> ex: reply
>>>>>>
>>>>>>  @GET
>>>>>>  @Path("/customers/{id}/")
>>>>>>  public Customer getCustomer(Customer customer) {
>>>>>>      return customer;
>>>>>>  }
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles Moulliard
>>>>>> Senior Enterprise Architect
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> *****************************
>>>>>> blog : http://cmoulliard.blogspot.com
>>>>>> twitter : http://twitter.com/cmoulliard
>>>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>
>>>>>> Apache Camel Group :
>>>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>
>

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