You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2025/02/18 08:17:00 UTC
[jira] [Resolved] (CAMEL-21741) MainHttpServer needs to get registered/started explicitly
[ https://issues.apache.org/jira/browse/CAMEL-21741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-21741.
---------------------------------
Fix Version/s: 4.11.0
Resolution: Information Provided
That is intentional when you create Camel yourself via new DefaultCamelContext and setup .. then you need to do a bit more, as running via CSB/CEQ or via camel-main ala jbang
> 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
> Priority: Major
> Fix For: 4.11.0
>
>
> With a simple route like this ...
> {code:java}
> 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:java}
> 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:java}
> 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)