复制 from confluent_kafka import Producer, Consumer conf = { 'bootstrap.servers': 'kafka.example.com:9092', 'security.protocol': 'ssl', 'ssl.ca.location': '/path/to/ca.crt', 'ssl.certificate.location': '/path/to/client.crt', 'ssl.key.location': '/path/to/client.key', 'ssl.key...
asyncio_example.py avro_consumer.py avro_producer.py confluent_cloud.py consumer.py eos-transactions.py get_watermark_offsets.py json_consumer.py json_producer.py oauth_producer.py producer.py protobuf_consumer.py protobuf_producer.py requirements.txt ...
# Example Kafka Producer. # Reads lines from stdin and sends to Kafka. # fromconfluent_kafkaimportProducer importsys if__name__=='__main__': iflen(sys.argv)!=3: sys.stderr.write('Usage: %s <bootstrap-brokers> <topic>\n'%sys.argv[0]) ...
Confluent Kafka python producer poll()方法Producer poll是produce为传递回调调用的内部函数。你不会直接...
Basic Producer Examplefrom confluent_kafka import Producer p = Producer({'bootstrap.servers': 'mybroker1,mybroker2'}) def delivery_report(err, msg): """ Called once for each message produced to indicate delivery result. Triggered by poll() or flush(). """ if err is not None: print(...
Added an example for OAUTH OIDC producer with support for confluent cloud (#1769, @sarwarbhuiyan) confluent-kafka-python is based on librdkafka v2.6.1, see the librdkafka release notes for a complete list of changes, enhancements, fixes and upgrade considerations. Contributors sarwarbhuiyan ...
Added producer.purge() to purge messages in-queue/flight (@peteryin21, #548) Added AdminClient.list_groups() API (@messense, #948) Rename asyncio.py example to avoid circular import (#945) confluent-kafka-python is based on librdkafka v1.6.0, see the librdkafka release notes for a ...
Hello, we have an example using asyncio. You have to use a different thread to poll (producer/consumer) or consume (consumer) and make sure all the callbacks, are wrapped with call_soon_threadsafe to return to the event loop thread. We'll be working on an easier to implement API for ...
producer.poll() will still block indefinitely if the broker is unavailable. Thanks! How to reproduce create a producer configured with an unavailable/unreachable broker address. e.g. producer = confluent_kafka.Producer({"bootstrap.servers": "unreachable.example.com", "request.timeout.ms": 1000}...
Description from confluent_kafka import Consumer conf = { 'bootstrap.servers': 'localhost:8082', 'group.id': 'myconsumer', 'security.protocol': 'sasl_ssl', 'sasl.mechanism': 'PLAIN', 'sasl.username': 'myusername', 'sasl.password': 'badpa...