osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can not locate rest api


My rest route if requires

<rests xmlns="http://camel.apache.org/schema/spring";>
<rest id="rest-route">
<get uri="/test">
<to uri="direct:test"/>
</get>
</rest>
</rests>

On 28 May 2018 at 12:43, Ranabroto Ghosh <ranabroto.ghosh@xxxxxxxxxxxxxxxx>
wrote:

> Hi I am using springboot with Camel, my routes are getting started
> correctly but ca not trigger rest apis as i ca not locate them.
>
> *pom.xml *
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.camel</groupId>
> <artifactId>spring-camel</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <packaging>jar</packaging>
>
> <name>spring-camel</name>
> <description>Demo project for Spring Boot</description>
> <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
> <java.version>1.8</java.version>
> <camel.version>2.21.0</camel.version>
> </properties>
>
> <dependencies>
> <dependency>
>     <groupId>org.apache.camel</groupId>
>     <artifactId>camel-spring-boot-starter</artifactId>
>     <version>${camel.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel</groupId>
> <artifactId>camel-restlet</artifactId>
> <version>${camel.version}</version>
> </dependency>
> </dependencies>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.springframework.boot</groupId>
> <artifactId>spring-boot-maven-plugin</artifactId>
> </plugin>
> </plugins>
> </build>
> </project>
>
>
> *application.xml*
> camel.springboot.xmlRoutes = true
> camel.springboot.xmlRoutes = classpath:xml-route/*.xml
> camel.springboot.main-run-controller=true
> camel.springboot.xmlRests = true
> camel.springboot.xmlRests = classpath:xml-rest/*.xml
> server.port = 8084
> spring.application.name = spring-camel
>
> *Springboot Main class:*
>
> @SpringBootApplication
> @EnableAutoConfiguration
> public class SpringCamelApplication {
>
> public static void main(String[] args) {
> SpringApplication.run(SpringCamelApplication.class, args);
> }
> }
>
>
> *LOG after application started:*
>
> 2018-05-28 12:34:46.178  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : StreamCaching is not in use. If using streams then its recommended to
> enable stream caching. See more details at http://camel.apache.org/
> stream-caching.html
> 2018-05-28 12:34:46.211  INFO 4852 --- [           main]
> o.a.camel.component.file.FileEndpoint    : Endpoint is configured with
> noop=true so forcing endpoint to be idempotent as well
> 2018-05-28 12:34:46.211  INFO 4852 --- [           main]
> o.a.camel.component.file.FileEndpoint    : Using default memory based
> idempotent repository with cache max size: 1000
> 2018-05-28 12:34:46.357  INFO 4852 --- [           main]
> o.a.camel.spring.boot.RoutesCollector    : Starting
> CamelMainRunController to ensure the main thread keeps running
> 2018-05-28 12:34:46.361  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : Route: first-route started and consuming from: direct://test
> 2018-05-28 12:34:46.374  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : Route: second-route started and consuming from:
> file://E://inputFolder?noop=true
> 2018-05-28 12:34:46.384  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : Route: route1 started and consuming from: restlet:///test?
> restletMethods=GET
> 2018-05-28 12:34:46.385  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : Total 3 routes, of which 3 are started
> 2018-05-28 12:34:46.388  INFO 4852 --- [           main] o.a.camel.spring.SpringCamelContext
>     : Apache Camel 2.21.0 (CamelContext: camel-1) started in 0.471 seconds
> 2018-05-28 12:34:46.395  INFO 4852 --- [           main] c.c.springcamel.SpringCamelApplication
>  : Started SpringCamelApplication in 3.543 seconds (JVM running for 3.878)
> 2018-05-28 12:34:47.389  INFO 4852 --- [E://inputFolder] second-route
>                        : ROUTE STARTED
>
>
>
> So clearly it says ' route1 started and consuming from: restlet:///test?restletMethods=GET'
> but when i call http:localhost:8084/test its says unreachable.
>
>
> Badly need help, thanks in advance.
> --
> Kind Regards
> Rana
>



-- 
Kind Regards
Rana