Sorry, that was a link to the processor working with JAX-RS contexts,

this one is doing something that a JAX-RS service has returned as a result of 'performInvocation', in this case it is a Customer bean:

https://github.com/apache/camel/blob/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringConsumerTest.java#L48

May be it is off-topic, sorry for the noise if so...
Sergey


On 10/02/16 22:16, Sergey Beryozkin wrote:
I don't quite follow what are you saying about performInvocation,
there's a simple test, with the processor coded as follows:

https://github.com/apache/camel/blob/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java#L276


Are you trying to use it with CXFRS using an interface/no-op imlpl ? May
be I need to tighten the code to make sure 'performInvocation' is
ignored in such cases...

Sergey
On 10/02/16 21:51, camel_case wrote:
performInvocation allows you to use the resource file to match http
method
type (GET POST PUT DELETE) to a method in the resource file.  However, it
wipes out the Exchange headers and body, and the return value is set
to the
Exchange.In body, except when null is returned.  There doesn't seem to
be a
way to access the exchange, In or Out, headers or body, get or set,
inside
the resource method.  One does have access to @PathParam or
@QueryParam that
appear in the method signature params which could then be set in the
body,
are returned to the route, passed in the Exchange.  The method can call a
service and return values to the calling route in the inBody.

Alternatively, one can direct the cxfrs routes according to http
method by
using recipient list as in

  .recipientList(simple("direct:${header.CamelHttpMethod}"));

In either case, one could then use the same target url ( as in
http://mycompany.com/callrestservice?myparam=12 and the route finds the
service restfully according to the http method.
With the recipientList trick, the routes are set up with endpoints start
direct:GET direct:POST direct:PUT direct:DELETE
With peformInvocation, each resource method can call an appropriate
service.

Furthermore, two identical url requests distinguished only by use of
pathParam vs. queryParam or even the name of the param, can be routed,
with
a further refinement of recipientList trick or if statement in resource
method, or .choice( in route.

This routing style is actually built in to the rest dsl as in
rest(url).get
etc.

It is difficult to find debate over cxfrs vs rest dsl (avail only
since Fall
2015)




--
View this message in context:
http://camel.465427.n5.nabble.com/Multiple-consumers-for-the-same-endpoint-is-not-allowed-cxfrs-vs-rest-dsl-tp5777492p5777554.html

Sent from the Camel - Users mailing list archive at Nabble.com.





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to