Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing Rest endpoint #212

Closed
shyabithd opened this issue Nov 13, 2018 · 12 comments
Closed

Exposing Rest endpoint #212

shyabithd opened this issue Nov 13, 2018 · 12 comments

Comments

@shyabithd
Copy link

Description:

I tried to create a rest endpoint using camel-k however when DSL is deployed I got following error.
Should Camel-k download dependent components?

[2] Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[rest:get:/hello?routeId=route1]] -> [To[... because of Cannot find RestConsumerFactory in Registry or as a Component to use
[2] at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
[2] at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3949)
[2] at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3856)
[2] at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
[2] at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
[2] at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
[2] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
[2] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
[2] at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
[2] at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
[2] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
[2] at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
[2] at org.apache.camel.k.jvm.Runtime.doStart(Runtime.java:101)
[2] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
[2] at org.apache.camel.main.MainSupport.run(MainSupport.java:170)
[2] at org.apache.camel.k.jvm.Application.main(Application.java:65)
[2] Caused by: java.lang.IllegalStateException: Cannot find RestConsumerFactory in Registry or as a Component to use
[2] at org.apache.camel.component.rest.RestEndpoint.createConsumer(RestEndpoint.java:526)
[2] at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
[2] at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107)
[2] at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
[2] at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)

@lburgazzoli
Copy link
Contributor

Can you post the full route ?

@zregvart
Copy link
Member

I think there could be a missing RestConsumerFactory implementation from one of the supporting components:

https://github.com/apache/camel/blob/85954bfb0ec7e2c26f5cc467d9b7c60195e8f4c6/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java#L52

Could Camel-K be aware of this and add additional component to classpath?

@lburgazzoli
Copy link
Contributor

yes camel-k can do that :) we need to check the route to see if there are missing cases.

@shyabithd
Copy link
Author

Hi @lburgazzoli,

Thank you for the quick response.
This is just to get an idea how things work. Here is the route file.

import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;

public class RestTest extends RouteBuilder {
@OverRide
public void configure() throws Exception {
restConfiguration().component("restlet").host("localhost").port("8080");
rest().get("/hello").to("direct:hello");
from("direct:hello").log(LoggingLevel.INFO, "Hello World").transform().simple("Hello World");
}
}

@lburgazzoli
Copy link
Contributor

will have a look, in the meantime you can try to add the restlet dependency like:

kamel run -d camel:restlet ...

@nicolaferraro
Copy link
Member

Yeah, I think current metadata discovery works with explicit uris (e.g. "undertow:http..."), we should make it more intelligent..

@shyabithd
Copy link
Author

shyabithd commented Nov 13, 2018

@lburgazzoli - Sorry for the confusion. Still the exception exists after trying with the restlet dependency

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Nov 14, 2018

sorry my mistake:

kamel run --dependency=camel-restlet ...

@shyabithd
Copy link
Author

Hi @lburgazzoli - Another small question, After I deploy the DSL, I noticed that ingress does not create. Have you noticed an issue like that?

@nicolaferraro
Copy link
Member

We're about to release v 0.0.5 that contains the generator for ingress.

@lburgazzoli
Copy link
Contributor

@nicolaferraro I think we can close this one, right ?

@nicolaferraro
Copy link
Member

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants