This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new c8747fa4e Fix #3210: spring-rabbitmq Kamelets check the broker 
certificate and host name with amqps, and take a trust store (#3211)
c8747fa4e is described below

commit c8747fa4e6b87952f94a67625e0a4f7ce641455a
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 18 21:38:39 2026 +0100

    Fix #3210: spring-rabbitmq Kamelets check the broker certificate and host 
name with amqps, and take a trust store (#3211)
    
    With protocol amqps, spring-rabbitmq-source and spring-rabbitmq-sink now
    create the RabbitMQ connection factory with Spring AMQP's
    RabbitConnectionFactoryBean, wrapped in a CachingConnectionFactory. TLS
    then checks the certificate of the broker with the trust store of Java
    and verifies the host name of the broker. Before, the Kamelets handed an
    amqps:// URI to the RabbitMQ client, whose default TLS setup for such a
    URI checks neither.
    
    The new options sslTruststoreLocation and sslTruststorePassword give a
    trust store for a broker with a certificate from a private or
    self-signed authority.
    
    A broker whose certificate Java does not trust, or whose certificate
    does not name the host, no longer connects with amqps. The Good to know
    of both Kamelets says so. protocol amqp (the default) is unchanged.
    
    SpringRabbitmqKameletTlsTest runs both Kamelets against a local TLS
    server (and a plain one for amqp).
    
    Signed-off-by: Claus Ibsen <[email protected]>
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 kamelets/spring-rabbitmq-sink.kamelet.yaml         |  34 +++-
 kamelets/spring-rabbitmq-source.kamelet.yaml       |  33 ++-
 library/camel-kamelets-catalog/pom.xml             |  25 +++
 .../catalog/SpringRabbitmqKameletTlsTest.java      | 225 +++++++++++++++++++++
 .../resources/spring-rabbitmq/broker-keystore.p12  | Bin 0 -> 2584 bytes
 .../test/resources/spring-rabbitmq/truststore.p12  | Bin 0 -> 1126 bytes
 .../main/resources/META-INF/kamelets-index.json    |   4 +-
 .../kamelets/spring-rabbitmq-sink.kamelet.yaml     |  34 +++-
 .../kamelets/spring-rabbitmq-source.kamelet.yaml   |  33 ++-
 9 files changed, 362 insertions(+), 26 deletions(-)

diff --git a/kamelets/spring-rabbitmq-sink.kamelet.yaml 
b/kamelets/spring-rabbitmq-sink.kamelet.yaml
index 05aaf03a5..6476aef25 100644
--- a/kamelets/spring-rabbitmq-sink.kamelet.yaml
+++ b/kamelets/spring-rabbitmq-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: the message is unchanged.
 
-      Good to know: it does not create the exchange, unless 
`autoDeclareProducer` is true. A message sent to an exchange that does not 
exist is lost without an error, unless publisher confirms are on 
(`publisherConfirmType` and `confirm`), and RabbitMQ drops a message that no 
queue is bound to take. It connects with no TLS unless `protocol` is `amqps`. 
It does not wait for a reply, even when the incoming message expects one, as 
one from `webhook-source` does.
+      Good to know: it does not create the exchange, unless 
`autoDeclareProducer` is true. A message sent to an exchange that does not 
exist is lost without an error, unless publisher confirms are on 
(`publisherConfirmType` and `confirm`), and RabbitMQ drops a message that no 
queue is bound to take. It connects with no TLS unless `protocol` is `amqps`. 
With `amqps`, the certificate of the broker must be trusted by Java, or by the 
trust store in `sslTruststoreLocation`, and must name the  [...]
     required:
       - host
       - port
@@ -113,22 +113,44 @@ spec:
         default: "/"
       protocol:
         title: "Protocol"
-        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS."
+        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS, which checks the certificate of the broker and 
its host name."
         type: string
         enum: ["amqp", "amqps"]
         default: "amqp"
+      sslTruststoreLocation:
+        title: "SSL Truststore Location"
+        description: "The location of a trust store, in JKS or PKCS12 format, 
with the certificate of the authority that signed the certificate of the 
broker, such as `file:/etc/rabbitmq/truststore.p12`, or 
`classpath:truststore.p12` for one on the classpath. A path without `file:` is 
looked up on the classpath. Needed only with `amqps` when the broker uses a 
certificate that Java does not trust by default, such as one from a private or 
self-signed authority. Not used with `amqp`."
+        type: string
+        example: "file:/etc/rabbitmq/truststore.p12"
+      sslTruststorePassword:
+        title: "SSL Truststore Password"
+        description: "The password of the trust store in 
`sslTruststoreLocation`."
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dependencies:
     - "camel:spring-rabbitmq"
     - "camel:kamelet"
   template:
     beans:
-      - name: connectionFactory
-        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+      - name: rabbitConnectionFactory
+        type: "#class:com.rabbitmq.client.ConnectionFactory"
+        builderClass: 
org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean
+        builderMethod: getObject
         properties:
-          username: "{{?username}}"
-          password: "{{?password}}"
+          singleton: false
           uri: "{{protocol}}://{{host}}:{{port}}"
           virtualHost: "{{vhost}}"
+          username: "{{?username}}"
+          password: "{{?password}}"
+          trustStore: "{{?sslTruststoreLocation}}"
+          trustStorePassphrase: "{{?sslTruststorePassword}}"
+      - name: connectionFactory
+        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+        constructors:
+          0: "#bean:{{rabbitConnectionFactory}}"
+        properties:
           publisherConfirmType: "{{publisherConfirmType}}"
     from:
       uri: kamelet:source
diff --git a/kamelets/spring-rabbitmq-source.kamelet.yaml 
b/kamelets/spring-rabbitmq-source.kamelet.yaml
index 64cd103b7..b3e84b3e4 100644
--- a/kamelets/spring-rabbitmq-source.kamelet.yaml
+++ b/kamelets/spring-rabbitmq-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
 
       Output: the body is text when the content type of the message starts 
with `text`, and bytes otherwise. The headers of the RabbitMQ message become 
headers, along with `CamelSpringRabbitmqExchangeName`, 
`CamelSpringRabbitmqRoutingKey` and `CamelSpringRabbitmqContentType`.
 
-      Good to know: with `autoDeclare` false, the default, the queue must 
exist already, bound to the exchange; until it does, the source keeps trying 
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange, 
the queue in `queues` and the binding with `routingKey`. Without `queues`, it 
reads from a new queue with a generated name. A message whose processing fails 
is tried 5 times, one second apart, and then dropped, or sent to the dead 
letter exchange of the queue w [...]
+      Good to know: with `autoDeclare` false, the default, the queue must 
exist already, bound to the exchange; until it does, the source keeps trying 
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange, 
the queue in `queues` and the binding with `routingKey`. Without `queues`, it 
reads from a new queue with a generated name. A message whose processing fails 
is tried 5 times, one second apart, and then dropped, or sent to the dead 
letter exchange of the queue w [...]
     required:
       - host
       - port
@@ -94,10 +94,22 @@ spec:
         default: "/"
       protocol:
         title: "Protocol"
-        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS."
+        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS, which checks the certificate of the broker and 
its host name."
         type: string
         enum: ["amqp", "amqps"]
         default: "amqp"
+      sslTruststoreLocation:
+        title: "SSL Truststore Location"
+        description: "The location of a trust store, in JKS or PKCS12 format, 
with the certificate of the authority that signed the certificate of the 
broker, such as `file:/etc/rabbitmq/truststore.p12`, or 
`classpath:truststore.p12` for one on the classpath. A path without `file:` is 
looked up on the classpath. Needed only with `amqps` when the broker uses a 
certificate that Java does not trust by default, such as one from a private or 
self-signed authority. Not used with `amqp`."
+        type: string
+        example: "file:/etc/rabbitmq/truststore.p12"
+      sslTruststorePassword:
+        title: "SSL Truststore Password"
+        description: "The password of the trust store in 
`sslTruststoreLocation`."
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dataTypes:
     out:
       headers:
@@ -118,13 +130,22 @@ spec:
     - "camel:kamelet"
   template:
     beans:
-      - name: connectionFactory
-        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+      - name: rabbitConnectionFactory
+        type: "#class:com.rabbitmq.client.ConnectionFactory"
+        builderClass: 
org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean
+        builderMethod: getObject
         properties:
-          username: "{{?username}}"
-          password: "{{?password}}"
+          singleton: false
           uri: "{{protocol}}://{{host}}:{{port}}"
           virtualHost: "{{vhost}}"
+          username: "{{?username}}"
+          password: "{{?password}}"
+          trustStore: "{{?sslTruststoreLocation}}"
+          trustStorePassphrase: "{{?sslTruststorePassword}}"
+      - name: connectionFactory
+        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+        constructors:
+          0: "#bean:{{rabbitConnectionFactory}}"
     from:
       uri: 
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
       steps:
diff --git a/library/camel-kamelets-catalog/pom.xml 
b/library/camel-kamelets-catalog/pom.xml
index 17d4c46ba..548c1d4c0 100644
--- a/library/camel-kamelets-catalog/pom.xml
+++ b/library/camel-kamelets-catalog/pom.xml
@@ -111,6 +111,12 @@
             <scope>test</scope>
             <version>${junit-jupiter-version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+            <version>${junit-jupiter-version}</version>
+        </dependency>
         <!-- KameletsCanonicalTest: loads every Kamelet with the YAML DSL to 
find the compact notation -->
         <dependency>
             <groupId>org.apache.camel</groupId>
@@ -124,6 +130,25 @@
             <version>${camel.version}</version>
             <scope>test</scope>
         </dependency>
+        <!-- SpringRabbitmqKameletTlsTest: runs the RabbitMQ Kamelets against 
a local TLS server -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core-languages</artifactId>
+            <version>${camel.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-kamelet</artifactId>
+            <version>${camel.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring-rabbitmq</artifactId>
+            <version>${camel.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-tooling-model</artifactId>
diff --git 
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/SpringRabbitmqKameletTlsTest.java
 
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/SpringRabbitmqKameletTlsTest.java
new file mode 100644
index 000000000..b30d31624
--- /dev/null
+++ 
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/SpringRabbitmqKameletTlsTest.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.kamelets.catalog;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.KeyStore;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLSocket;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.kamelet.KameletComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Runs spring-rabbitmq-sink and spring-rabbitmq-source against a local server 
that only does the TLS handshake (or
+ * reads the AMQP protocol header), to check how they connect to the broker 
with each protocol.
+ */
+public class SpringRabbitmqKameletTlsTest {
+
+    // the source files, not the catalog jar
+    private static final Path KAMELETS = Path.of("../../kamelets");
+    private static final Path RESOURCES = 
Path.of("src/test/resources/spring-rabbitmq");
+    // the broker certificate is for the host name localhost only
+    private static final String BROKER_KEYSTORE = "broker-keystore.p12";
+    private static final String TRUSTSTORE = "truststore.p12";
+    private static final String STORE_PASSWORD = "changeit";
+    private static final long TIMEOUT_SECONDS = 20;
+
+    private final ExecutorService executor = 
Executors.newSingleThreadExecutor();
+    private ServerSocket server;
+    private CamelContext context;
+
+    @AfterEach
+    void stop() throws Exception {
+        if (server != null) {
+            server.close();
+        }
+        if (context != null) {
+            context.stop();
+        }
+        executor.shutdownNow();
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = { "spring-rabbitmq-sink", "spring-rabbitmq-source" 
})
+    void amqpsChecksBrokerCertificateWithJavaTrustStore(String kamelet) throws 
Exception {
+        CompletableFuture<Boolean> handshake = startTlsServer();
+
+        connect(kamelet, "localhost", "protocol=amqps");
+
+        assertFalse(handshake.get(TIMEOUT_SECONDS, TimeUnit.SECONDS),
+                "the certificate of the broker is not in the trust store of 
Java, so the connection must fail");
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = { "spring-rabbitmq-sink", "spring-rabbitmq-source" 
})
+    void amqpsAcceptsBrokerCertificateFromTrustStore(String kamelet) throws 
Exception {
+        CompletableFuture<Boolean> handshake = startTlsServer();
+
+        connect(kamelet, "localhost", "protocol=amqps&" + trustStoreOptions());
+
+        assertTrue(handshake.get(TIMEOUT_SECONDS, TimeUnit.SECONDS),
+                "the certificate of the broker is in sslTruststoreLocation, so 
the connection must succeed");
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = { "spring-rabbitmq-sink", "spring-rabbitmq-source" 
})
+    void amqpsVerifiesBrokerHostName(String kamelet) throws Exception {
+        CompletableFuture<Boolean> handshake = startTlsServer();
+
+        // the certificate names localhost, not the IP address
+        connect(kamelet, InetAddress.getLoopbackAddress().getHostAddress(), 
"protocol=amqps&" + trustStoreOptions());
+
+        assertFalse(handshake.get(TIMEOUT_SECONDS, TimeUnit.SECONDS),
+                "the certificate of the broker does not name the host, so the 
connection must fail");
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = { "spring-rabbitmq-sink", "spring-rabbitmq-source" 
})
+    void amqpConnectsWithoutTls(String kamelet) throws Exception {
+        CompletableFuture<String> header = startPlainServer();
+
+        connect(kamelet, "localhost", "protocol=amqp");
+
+        assertEquals("AMQP", header.get(TIMEOUT_SECONDS, TimeUnit.SECONDS));
+    }
+
+    private static String trustStoreOptions() {
+        return "sslTruststoreLocation=RAW(file:" + 
RESOURCES.resolve(TRUSTSTORE).toAbsolutePath()
+               + ")&sslTruststorePassword=RAW(" + STORE_PASSWORD + ")";
+    }
+
+    /**
+     * Starts the Kamelet, which connects to the broker at once: the sink when 
it sends a message, the source when its
+     * route starts.
+     */
+    private void connect(String kamelet, String host, String options) throws 
Exception {
+        String uri = "kamelet:" + kamelet + "?host=" + host + "&port=" + 
server.getLocalPort()
+                     + "&exchangeName=orders&" + options;
+
+        context = new DefaultCamelContext();
+        context.getComponent("kamelet", KameletComponent.class)
+                .setLocation("file:" + KAMELETS.toAbsolutePath().normalize());
+        if (kamelet.endsWith("-source")) {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from(uri).process(exchange -> {
+                    });
+                }
+            });
+            context.start();
+        } else {
+            context.start();
+            ProducerTemplate template = context.createProducerTemplate();
+            try {
+                template.sendBody(uri, "hello");
+            } catch (CamelExecutionException e) {
+                // the server is not a broker: it only does the TLS handshake 
or reads the protocol header
+            }
+        }
+    }
+
+    /**
+     * Starts a TLS server with the broker certificate, for the first 
connection only.
+     *
+     * @return completes with whether the TLS handshake with the Kamelet 
succeeded, once it connected
+     */
+    private CompletableFuture<Boolean> startTlsServer() throws Exception {
+        KeyStore keyStore = KeyStore.getInstance("PKCS12");
+        try (InputStream is = 
Files.newInputStream(RESOURCES.resolve(BROKER_KEYSTORE))) {
+            keyStore.load(is, STORE_PASSWORD.toCharArray());
+        }
+        KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+        kmf.init(keyStore, STORE_PASSWORD.toCharArray());
+        SSLContext sslContext = SSLContext.getInstance("TLS");
+        sslContext.init(kmf.getKeyManagers(), null, null);
+
+        SSLServerSocket tls = (SSLServerSocket) 
sslContext.getServerSocketFactory().createServerSocket();
+        tls.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+        server = tls;
+
+        CompletableFuture<Boolean> handshake = new CompletableFuture<>();
+        executor.submit(() -> {
+            try (Socket socket = accept()) {
+                try {
+                    ((SSLSocket) socket).startHandshake();
+                    handshake.complete(true);
+                } catch (IOException e) {
+                    handshake.complete(false);
+                }
+            } catch (Exception e) {
+                handshake.completeExceptionally(e);
+            }
+        });
+        return handshake;
+    }
+
+    /**
+     * Starts a plain server, for the first connection only.
+     *
+     * @return completes with the first 4 bytes the Kamelet sent
+     */
+    private CompletableFuture<String> startPlainServer() throws Exception {
+        server = new ServerSocket();
+        server.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 
0));
+
+        CompletableFuture<String> header = new CompletableFuture<>();
+        executor.submit(() -> {
+            try (Socket socket = accept()) {
+                byte[] bytes = socket.getInputStream().readNBytes(4);
+                header.complete(new String(bytes, StandardCharsets.US_ASCII));
+            } catch (Exception e) {
+                header.completeExceptionally(e);
+            }
+        });
+        return header;
+    }
+
+    private Socket accept() throws IOException {
+        server.setSoTimeout((int) TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS));
+        Socket socket = server.accept();
+        socket.setSoTimeout((int) TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS));
+        return socket;
+    }
+}
diff --git 
a/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/broker-keystore.p12
 
b/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/broker-keystore.p12
new file mode 100644
index 000000000..59035ed6d
Binary files /dev/null and 
b/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/broker-keystore.p12
 differ
diff --git 
a/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/truststore.p12
 
b/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/truststore.p12
new file mode 100644
index 000000000..c938bee45
Binary files /dev/null and 
b/library/camel-kamelets-catalog/src/test/resources/spring-rabbitmq/truststore.p12
 differ
diff --git 
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json 
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 48e79ce9b..951033395 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2115,7 +2115,7 @@
     "supportLevel" : "Preview",
     "title" : "RabbitMQ Sink",
     "summary" : "Publishes each message to an exchange in a RabbitMQ broker, 
which routes it to queues by its routing key.",
-    "description" : "Publishes each message to an exchange in a RabbitMQ 
broker, which routes it to queues by its routing key.\n\nUse it to hand work or 
events to applications that read from RabbitMQ queues. Use 
`spring-rabbitmq-source` to read from them.\n\nInput: the body is the payload, 
as text or bytes. Text is sent with the content type `text/plain`, and bytes 
with `application/octet-stream`. A Map fails, and so does an empty body: turn 
structured data into JSON text first, for exam [...]
+    "description" : "Publishes each message to an exchange in a RabbitMQ 
broker, which routes it to queues by its routing key.\n\nUse it to hand work or 
events to applications that read from RabbitMQ queues. Use 
`spring-rabbitmq-source` to read from them.\n\nInput: the body is the payload, 
as text or bytes. Text is sent with the content type `text/plain`, and bytes 
with `application/octet-stream`. A Map fails, and so does an empty body: turn 
structured data into JSON text first, for exam [...]
     "group" : "RabbitMQ",
     "namespace" : "Messaging",
     "provider" : "Apache Software Foundation"
@@ -2125,7 +2125,7 @@
     "supportLevel" : "Preview",
     "title" : "RabbitMQ Source",
     "summary" : "Receives each message from a queue in a RabbitMQ broker, and 
can create that queue and bind it to an exchange with a routing key.",
-    "description" : "Receives each message from a queue in a RabbitMQ broker, 
and can create that queue and bind it to an exchange with a routing key.\n\nUse 
it to process work or events that other applications publish to RabbitMQ. Use 
`spring-rabbitmq-sink` to publish them.\n\nOutput: the body is text when the 
content type of the message starts with `text`, and bytes otherwise. The 
headers of the RabbitMQ message become headers, along with 
`CamelSpringRabbitmqExchangeName`, `CamelSpring [...]
+    "description" : "Receives each message from a queue in a RabbitMQ broker, 
and can create that queue and bind it to an exchange with a routing key.\n\nUse 
it to process work or events that other applications publish to RabbitMQ. Use 
`spring-rabbitmq-sink` to publish them.\n\nOutput: the body is text when the 
content type of the message starts with `text`, and bytes otherwise. The 
headers of the RabbitMQ message become headers, along with 
`CamelSpringRabbitmqExchangeName`, `CamelSpring [...]
     "group" : "RabbitMQ",
     "namespace" : "Messaging",
     "provider" : "Apache Software Foundation"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
index 05aaf03a5..6476aef25 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
 
       Output: the message is unchanged.
 
-      Good to know: it does not create the exchange, unless 
`autoDeclareProducer` is true. A message sent to an exchange that does not 
exist is lost without an error, unless publisher confirms are on 
(`publisherConfirmType` and `confirm`), and RabbitMQ drops a message that no 
queue is bound to take. It connects with no TLS unless `protocol` is `amqps`. 
It does not wait for a reply, even when the incoming message expects one, as 
one from `webhook-source` does.
+      Good to know: it does not create the exchange, unless 
`autoDeclareProducer` is true. A message sent to an exchange that does not 
exist is lost without an error, unless publisher confirms are on 
(`publisherConfirmType` and `confirm`), and RabbitMQ drops a message that no 
queue is bound to take. It connects with no TLS unless `protocol` is `amqps`. 
With `amqps`, the certificate of the broker must be trusted by Java, or by the 
trust store in `sslTruststoreLocation`, and must name the  [...]
     required:
       - host
       - port
@@ -113,22 +113,44 @@ spec:
         default: "/"
       protocol:
         title: "Protocol"
-        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS."
+        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS, which checks the certificate of the broker and 
its host name."
         type: string
         enum: ["amqp", "amqps"]
         default: "amqp"
+      sslTruststoreLocation:
+        title: "SSL Truststore Location"
+        description: "The location of a trust store, in JKS or PKCS12 format, 
with the certificate of the authority that signed the certificate of the 
broker, such as `file:/etc/rabbitmq/truststore.p12`, or 
`classpath:truststore.p12` for one on the classpath. A path without `file:` is 
looked up on the classpath. Needed only with `amqps` when the broker uses a 
certificate that Java does not trust by default, such as one from a private or 
self-signed authority. Not used with `amqp`."
+        type: string
+        example: "file:/etc/rabbitmq/truststore.p12"
+      sslTruststorePassword:
+        title: "SSL Truststore Password"
+        description: "The password of the trust store in 
`sslTruststoreLocation`."
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dependencies:
     - "camel:spring-rabbitmq"
     - "camel:kamelet"
   template:
     beans:
-      - name: connectionFactory
-        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+      - name: rabbitConnectionFactory
+        type: "#class:com.rabbitmq.client.ConnectionFactory"
+        builderClass: 
org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean
+        builderMethod: getObject
         properties:
-          username: "{{?username}}"
-          password: "{{?password}}"
+          singleton: false
           uri: "{{protocol}}://{{host}}:{{port}}"
           virtualHost: "{{vhost}}"
+          username: "{{?username}}"
+          password: "{{?password}}"
+          trustStore: "{{?sslTruststoreLocation}}"
+          trustStorePassphrase: "{{?sslTruststorePassword}}"
+      - name: connectionFactory
+        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+        constructors:
+          0: "#bean:{{rabbitConnectionFactory}}"
+        properties:
           publisherConfirmType: "{{publisherConfirmType}}"
     from:
       uri: kamelet:source
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
index 64cd103b7..b3e84b3e4 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
 
       Output: the body is text when the content type of the message starts 
with `text`, and bytes otherwise. The headers of the RabbitMQ message become 
headers, along with `CamelSpringRabbitmqExchangeName`, 
`CamelSpringRabbitmqRoutingKey` and `CamelSpringRabbitmqContentType`.
 
-      Good to know: with `autoDeclare` false, the default, the queue must 
exist already, bound to the exchange; until it does, the source keeps trying 
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange, 
the queue in `queues` and the binding with `routingKey`. Without `queues`, it 
reads from a new queue with a generated name. A message whose processing fails 
is tried 5 times, one second apart, and then dropped, or sent to the dead 
letter exchange of the queue w [...]
+      Good to know: with `autoDeclare` false, the default, the queue must 
exist already, bound to the exchange; until it does, the source keeps trying 
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange, 
the queue in `queues` and the binding with `routingKey`. Without `queues`, it 
reads from a new queue with a generated name. A message whose processing fails 
is tried 5 times, one second apart, and then dropped, or sent to the dead 
letter exchange of the queue w [...]
     required:
       - host
       - port
@@ -94,10 +94,22 @@ spec:
         default: "/"
       protocol:
         title: "Protocol"
-        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS."
+        description: "`amqp` for a plain connection, or `amqps` for a 
connection encrypted with TLS, which checks the certificate of the broker and 
its host name."
         type: string
         enum: ["amqp", "amqps"]
         default: "amqp"
+      sslTruststoreLocation:
+        title: "SSL Truststore Location"
+        description: "The location of a trust store, in JKS or PKCS12 format, 
with the certificate of the authority that signed the certificate of the 
broker, such as `file:/etc/rabbitmq/truststore.p12`, or 
`classpath:truststore.p12` for one on the classpath. A path without `file:` is 
looked up on the classpath. Needed only with `amqps` when the broker uses a 
certificate that Java does not trust by default, such as one from a private or 
self-signed authority. Not used with `amqp`."
+        type: string
+        example: "file:/etc/rabbitmq/truststore.p12"
+      sslTruststorePassword:
+        title: "SSL Truststore Password"
+        description: "The password of the trust store in 
`sslTruststoreLocation`."
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
   dataTypes:
     out:
       headers:
@@ -118,13 +130,22 @@ spec:
     - "camel:kamelet"
   template:
     beans:
-      - name: connectionFactory
-        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+      - name: rabbitConnectionFactory
+        type: "#class:com.rabbitmq.client.ConnectionFactory"
+        builderClass: 
org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean
+        builderMethod: getObject
         properties:
-          username: "{{?username}}"
-          password: "{{?password}}"
+          singleton: false
           uri: "{{protocol}}://{{host}}:{{port}}"
           virtualHost: "{{vhost}}"
+          username: "{{?username}}"
+          password: "{{?password}}"
+          trustStore: "{{?sslTruststoreLocation}}"
+          trustStorePassphrase: "{{?sslTruststorePassword}}"
+      - name: connectionFactory
+        type: 
"#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
+        constructors:
+          0: "#bean:{{rabbitConnectionFactory}}"
     from:
       uri: 
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
       steps:

Reply via email to