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