You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
from kafka import KafkaProducer
|
|
|
|
# 创建生产者
|
|
producer = KafkaProducer(bootstrap_servers='10.10.14.250:9092')
|
|
|
|
# 发送消息
|
|
producer.send('test-topic', b'Hello, Kafka ,ChangChun!')
|
|
producer.flush()
|
|
|
|
# 关闭生产者
|
|
producer.close() |