Thanks everyone and especially to Claus!
I spent a lot of time reading the documentation but I missed Main. Finally,
I managed to do it by adjusting the application.properties:

camel.ssl.enabled=true
camel.ssl.certAlias=alias
camel.ssl.keyStore=classpath:keystore/mydomain.com.p12
camel.ssl.keyStoreType=PKCS12
camel.ssl.keystorePassword=password


На вт, 3.12.2024 г. в 10:55 Pasquale Congiusti <pasquale.congiu...@gmail.com>
написа:

> If it helps, in Quarkus runtime this is pretty straightforward as it's
> achieved via 2 camel properties:
>
> quarkus.http.ssl.certificate.files=/etc/ssl/my-self-signed-ssl/server.crt
>
> quarkus.http.ssl.certificate.key-files=/etc/ssl/my-self-signed-ssl/server.key
>
> Then using the component normally exposes the platform-http server on 8443
> port (default) via HTTPS.
>
> Pasquale.
>
> On Tue, Dec 3, 2024 at 9:27 AM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
> > Hi
> >
> > You can configure SSL on camel-main in java or application.properties
> etc.
> >
> >
> https://camel.apache.org/components/4.8.x/others/main.html#_camel_embedded_http_server_only_for_standalone_not_spring_boot_or_quarkus_configurations
> >
> > this will then be used by camel-platform-http-main.
> >
> > However what you do should also be possible, but you need to tell
> > platform-main that it should use global SSL.
> >
> >
> >
> > 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");
> > >     }
> > > }
> > >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>

Reply via email to