Skip to content

add error_cb to confluent example #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/confluent_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@

from confluent_kafka import Producer, Consumer

def error_cb(err):
print(err.str())

p = Producer({
'bootstrap.servers': '<ccloud bootstrap servers>',
'sasl.mechanisms': 'PLAIN',
'security.protocol': 'SASL_SSL',
'sasl.username': '<ccloud key>',
'sasl.password': '<ccloud secret>'
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may look a read a little easier if we set the error cb in the conf dict itself.

i.e. https://github.com/confluentinc/confluent-kafka-python/blob/master/tests/integration/integration_test.py#L369

}, error_cb=error_cb)


def acked(err, msg):
Expand All @@ -84,7 +86,7 @@ def acked(err, msg):
'sasl.password': '<ccloud secret>',
'group.id': str(uuid.uuid1()), # this will create a new consumer group on each invocation.
'auto.offset.reset': 'earliest'
})
}, error_cb=error_cb)

c.subscribe(['python-test-topic'])

Expand Down