Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exposure of Camel routes as REST services under Web container

I have Camel route that I would like to expose as a REST Web Service. Application is deployed on Web container (Jetty/Tomcat) and Spring is used as well for DI and other "infrastructural" things.

I took a look at both camel-restlet and camel-cxfrs components and while they both provide support for exposing routes as REST services I was not able to find out how to avoid starting of separate server. What I'm really looking for is ability to define Camel route in a similar way to how routes are defined for Spring-WS inbound endpoints, e.g.

from("restlet://application/user/{id}").to(...)

Configuration of Web application should take care of accepting requests and transferring them to appropriate endpoints.

Have to admit I was pretty much surprised that I was not able to find sufficient info on the topic and I don't think that my requirements are very exotic.

like image 822
oiavorskyi Avatar asked Feb 24 '23 12:02

oiavorskyi


1 Answers

See this example http://camel.apache.org/cxf-tomcat-example.html

For Apache CXF you can use the servlet transport which allows you to tap into Tomcat/Jetty being the host container.

And if you use OSGi then take a look at this: http://camel.apache.org/cxf-example-osgi.html it shows how to use CXF with OSGi HTTP service, that should work as well for CXFRS.

like image 53
Claus Ibsen Avatar answered Apr 06 '23 14:04

Claus Ibsen