You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by alexey-s <al...@mail.ru> on 2015/04/20 14:30:09 UTC

Camel rest DSL and OSGI

I had a problem similar to
http://camel.465427.n5.nabble.com/Problem-with-Camel-rest-in-OSGi-td5758649.html

Read Wiki https://cwiki.apache.org/confluence/display/CAMEL/Rest+DSL

The Camel Rest component to use for the REST transport, such as restlet,
spark-rest. If no component has been explicit configured, then Camel will
lookup if there is a Camel component that integrates with the Rest DSL, or
if a org.apache.camel.spi.RestConsumerFactory is registered in the registry.
If either one is found, then that is being used.



I'm add to my karaf features.xml 


After run, see karaf.log

java.lang.IllegalStateException: Cannot find RestConsumerFactory in Registry
or as a Component to use
        at
org.apache.camel.component.rest.RestEndpoint.createConsumer(RestEndpoint.java:313)
        at
org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65)
        at
org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:85)
        at org.apache.camel.impl.RouteService.warmUp(RouteService.java:158)
        at
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3090)

Why the system did not find the component camel-servlet?


Add lines to RouteBuilder.


Error disappears. Test service

karaf.log:

OsgiDefaultCamelContext | 77 - org.apache.camel.camel-core - 2.15.1 | Route:
route-transform started and consuming from:
Endpoint[servlet:///transform/%7Buser%7D/%7Bid%7D/%7Btype%7D?httpMethodRestrict=GET]


wget http://localhost:8181/transform/user/id/type
return HTTP responce: 404 Not Found


---
Aleksey



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-rest-DSL-and-OSGI-tp5766059.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel rest DSL and OSGI

Posted by alexey-s <al...@mail.ru>.
We had to repeat the feat, as described in the file
https://github.com/apache/camel/blob/master/examples/camel-example-servlet-rest-blueprint/src/main/resources/OSGI-INF/blueprint/camel.xml

And this is called "then Camel will lookup if there is a Camel component
that integrates with the Rest DSL".

Add many codes for "lookup Camel component" :)



Add lines to RouteBuilder.



In my opinion, this is a difficult decision. Much heavier than a single line

where property service.hostUrl=http://localhost:8182/transform


---
Aleksey



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-rest-DSL-and-OSGI-tp5766059p5766067.html
Sent from the Camel - Users mailing list archive at Nabble.com.