0

I use the python Kafka Konsumer implementation as shown here:

from confluent_kafka import Consumer

c = Consumer({
    'group.id':'ABCDE',
    'auto.offset.reset': 'earliest',
    'enable.auto.commit': False,
    "bootstrap.servers": "server:3455",
    'security.protocol': 'SASL_SSL',
    'sasl.mechanisms': 'SCRAM-SHA-512',
    'sasl.username': 'user',
    'sasl.password': 'XXX'
})

c.subscribe(['topic'])

while True:
    msg = c.poll(1.0)

    if msg is None:
        continue
    if msg.error():
        print("Consumer error: {}".format(msg.error()))
        continue

    print('Received message: {}'.format(msg.value().decode('utf-8')))

c.close()

This code does neither return an error nor does it make any output. Even if I modify the password to an invalid one, I do not get any output...

The KafkaConsumer Library works:

consumer = KafkaConsumer('topic',
                     client_id='234253',
                     bootstrap_servers='server:3455',
                     enable_auto_commit=True,
                     security_protocol='SASL_SSL',
                     auto_offset_reset='latest',
                     sasl_mechanism='SCRAM-SHA-512',
                     sasl_plain_username='user',
                     sasl_plain_password='XXX')

What I am doing wrong with the confluent_kafka library?

user3579222
  • 1,103
  • 11
  • 28

0 Answers0