Thomas Diesler created CAMEL-21741:
--------------------------------------

             Summary: MainHttpServer needs to get registered/started explicitly
                 Key: CAMEL-21741
                 URL: https://issues.apache.org/jira/browse/CAMEL-21741
             Project: Camel
          Issue Type: Bug
          Components: camel-platform-http
            Reporter: Thomas Diesler


With a simple route like this ...

{code}
        camelContext = new DefaultCamelContext();
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("platform-http:/hello")
                        .setBody(constant("Hello, world!"));
            }
        });
        camelContext.start();
{code}

I get ...

{code}
No bean could be found in the registry for: platform-http-router of type: 
org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter
{code}

even though camel-platform-http-vertx is on the classpath.

After a little digging, I found that the MainHttpServer must be started 
explicitly or be registered with the CamelContext to get started implicitly.

{code}
        camelContext = new DefaultCamelContext();
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("platform-http:/hello")
                        .setBody(constant("Hello, Camel!"));
            }
        });

        MainHttpServer httpServer = new MainHttpServer();
        httpServer.setPort(port);
        camelContext.addService(httpServer);

        camelContext.start();
{code}

I wonder whether this is intentional and why it cannot be done by the 
camel-plattform-http component internally? Related is perhaps this section in 
[the 
docs|https://camel.apache.org/components/next/others/platform-http-main.html#_enabling]

{quote}The HTTP server for camel-main is disabled by default, and you need to 
explicitly enable this by setting camel.server.enabled=true in 
application.properties.{quote}







--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to