Skip to main content

Kafka Broker Connection

Connection to the Kafka broker is made using SASL/SCRAM (Salted Challenge Response Authentication Mechanism) authentication. The following steps must be performed to connect:

  1. Application settings:
    • Configure the application settings for connecting to the Kafka broker. The following parameters must be set:
      • bootstrap.servers: The address and port of the Kafka broker.
      • security.protocol: Set this value to SASL_SSL to use encrypted connection.
      • sasl.mechanism: Set this value to SCRAM-SHA-512, depending on which SCRAM algorithm you want to use.
      • sasl.jaas.config: Set this value with the SCRAM username and password (username is case sensitive). Example:
      sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="username" password="password";
  2. Connecting to the Kafka broker:
    • Create a Kafka producer or consumer object in the application with the appropriate settings.
    • When connecting, the application will use the SASL/SCRAM authentication configured in the settings. These are the general steps for connecting to the Kafka broker with SASL/SCRAM authentication.
Good to know

It is important to note that individual language or framework-based Kafka clients may implement configurations differently, so for the specific implementation it may be necessary to follow the documentation or the language framework-specific guide.