Search code examples
tagsmicronaut

Micronaut kafka project - mutiple consumers each with different bootstrap server and ssl certs


I am trying to set up a micronaut project with multiple consumers each with different bootstrap server and ssl certs. I am not setting global bootstrap server and certs. This does not work. Any suggestion is appreciated.

One another option is to combine the certs into one jks file and set global bootstrap and ssl configuration.

kafka:
  consumers:
    group1:
      bootstrap:
        servers: $someserver1
      ssl:
        keystore:
          location: /keystore.jks
          password: password
        truststore:
          location: /truststore.jks
          password: password
          type: PKCS12
      security:
        protocol: ssl
    group2:
      bootstrap:
        servers: $someserver2
      ssl:
        keystore:
          location: /keystore-1.jks
          password: password
        truststore:
          location: /truststore-1.jks
          password: password
          type: PKCS12
      security:
        protocol: ssl

Solution

  • The above config does work fine but u need to disable the kafka health check or provide a combined ssl certs otherwise micronaut kafka health check fails. This is true with 1.2.7 version of micronaut.

    kafka:
      health.enabled: false
      consumers:
        group1:
          bootstrap:
            servers: $someserver1
          ssl:
            keystore:
              location: /keystore.jks
              password: password
            truststore:
              location: /truststore.jks
              password: password
              type: PKCS12
          security:
            protocol: ssl
        group2:
          bootstrap:
            servers: $someserver2
          ssl:
            keystore:
              location: /keystore-1.jks
              password: password
            truststore:
              location: /truststore-1.jks
              password: password
              type: PKCS12
          security:
            protocol: ssl