camel-kafka-connector icon indicating copy to clipboard operation
camel-kafka-connector copied to clipboard

RabbitMQ connector enabling TLS connection

Open jakubmalek opened this issue 6 months ago • 4 comments

I'm struggle to find an option to enable TLS connection for RabbitMQ client in the connector.

Looking at the spring-rabbitmq-source.kamelet.yaml file I see that the Camel component is configured with connectionFactory bean from the Spring.

  • At first glance, the CachingConnectionFactory interface doesn't have any method for enabling TLS
  • One option is to set com.rabbitmq.client.ConnectionFactory instance configured with TLS in the CachingConnectionFactory constructor.
  • The other, which is more easy for Kamelet, is to set the URI parameter instead of a host name where its possible to define the protocol e.g. amqp://localhost or amqps://localhost for TLS connections.

So unless there is an easier way (that I missed) to enable TLS, my proposal is to change the Kamelet to

...
properties:
  ...
  protocol:
    title:  Protocol
    description: The AMQP protocol to use.
    type: string
    enum: ["amqp", "amqps"]
    default: "amqp"
  dependencies:
    - "camel:spring-rabbitmq"
    - "camel:kamelet"
  template:
    beans:
      - name: connectionFactory
        type: "#class:org.springframework.amqp.rabbit.connection.CachingConnectionFactory"
        properties:
          username: '{{?username}}'
          password: '{{?password}}'
          uri: '{{protocol}}://{{host}}:{{port}}'
          virtualHost: "{{vhost}}"
...

With protocol configured, we can enable or disable TLS.

jakubmalek avatar May 28 '25 15:05 jakubmalek

This will be in Kamelets catalog 4.12.0

oscerd avatar May 28 '25 16:05 oscerd

when 4.12.0 is planned to release?

pawlin avatar May 28 '25 21:05 pawlin

For the kamelets catalog it should be this week. For camel Kafka connector I don't know. We are trying to release only LTS stream and the next one will be 4.13

oscerd avatar May 28 '25 21:05 oscerd

Many, thanks your support

jakubmalek avatar Jun 02 '25 07:06 jakubmalek