I have never used the platform-http component myself, but from the
documentation it says that:

"The Platform HTTP is used to allow Camel to use the existing HTTP server
from the runtime. For example, when running Camel on Spring Boot, Quarkus,
or other runtimes. "

So I think the first question is, what for runtime are you using? I assume
that HTTPS then needs to be configured on your HTTP server level (though
the documentation says nothing about this point).

To use the JSSE utility (
https://camel.apache.org/manual/camel-configuration-utilities.html), the
Camel component needs support for it.

One of those components is Jetty:

https://camel.apache.org/components/4.8.x/jetty-component.html

You may also try it with that component, it contains an example of using
SSL.

Raymond








On Mon, Dec 2, 2024 at 8:36 PM <pas...@gmail.com> wrote:

> Hello,
> I'm new to Apache Camel and I have trouble exposing an HTTPS endpoint while
> using Platform HTTP Main. I have a valid, not expired Let's encrypt
> certificate. I'm using the default Vert.x web server. The code compiles
> well but I can only access the exposed endpoint over HTTP. I enabled the
> debug log but it looks like my ssl configuration is not applied. I'm using
> Apache Camel 4.8.1 with Java 21.
> I’d really appreciate any help!
>
> public final class MyApplication {
>     private MyApplication() {
>     }
>
>     public static void main(String[] args) throws Exception {
>         Main main = new Main(MyApplication.class);
>         main.configure().addRoutesBuilder(new WebhookRoutes());
>         main.run(args);
>     }
> }
>
>
> public class WebhookRoutes extends RouteBuilder {
>     @Override
>     public void configure() {
>         SSLContextParameters sslContextParameters = new
> SSLContextParameters();
>         sslContextParameters.setCertAlias("tomcat");
>
>         KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
>         keyStoreParameters.setType("PKCS12");
>         keyStoreParameters.setResource("keystore/mydomain.com.p12");
>         keyStoreParameters.setPassword("password");
>         sslContextParameters.setKeyManagers(new KeyManagersParameters() {{
>             setKeyStore(keyStoreParameters);
>             setKeyPassword("password");
>         }});
>
>         getContext().setSSLContextParameters(sslContextParameters);
>
>         // Endpoint for receiving webhooks
>
> from("platform-http:/hello?httpMethodRestrict=POST&consumes=application/json")
>                 .routeId("webhook-receiver")
>                 .to("kafka:incoming-topic?brokers=localhost:9092")
>                 .setBody(constant(null))
>                 .setHeader("CamelHttpResponseCode", constant(200));
>
>
> from("kafka:incoming-topic?brokers=localhost:9092&groupId=webhook-microservice")
>                 .routeId("kafka-processor")
>                  .log("Received message: ${body}")
>                 .to("kafka:processed-topic?brokers=localhost:9092");
>     }
> }
>

Reply via email to