kafka-python icon indicating copy to clipboard operation
kafka-python copied to clipboard

set parameter sasl.jaas.config for SASL PLAIN

Open mrshanth opened this issue 3 years ago • 1 comments

How to set the parameter sasl.jaas.config? The authentication is SASL and PLAIN mechanism

mrshanth avatar Sep 27 '21 16:09 mrshanth

I was able to do it using below connection setup

from kafka import KafkaConsumer


def main():
    print("Creating consumer...")
    consumer = KafkaConsumer('topic_name', 
    auto_offset_reset='earliest', enable_auto_commit=False,
    group_id='group1', 
    sasl_mechanism='PLAIN',
    security_protocol='SASL_SSL',
    sasl_plain_username='username',
    sasl_plain_password='passwoed',
    bootstrap_servers='server:9092'
    )
    for message in consumer:
        print ("%s:%d:%d: key=%s value=v" % (message.topic, message.partition,
                                            message.offset, message.key))

ashokdudhade-asurion avatar Dec 02 '21 19:12 ashokdudhade-asurion