Commit ec4c353c authored by 张彦钊's avatar 张彦钊

change test file

parent 6b325b05
...@@ -14,12 +14,9 @@ def on_send_error(): ...@@ -14,12 +14,9 @@ def on_send_error():
print("fail") print("fail")
return 0 return 0
if __name__ == "__main__": if __name__ == "__main__":
producer = KafkaProducer( producer = KafkaProducer(bootstrap_servers=['172.16.44.25:9092'],key_serializer=lambda k: pickle.dumps(k),value_serializer=lambda v: pickle.dumps(v))
bootstrap_servers=['172.16.44.25:9092'], print("hajs")
key_serializer=lambda k: pickle.dumps(k),
value_serializer=lambda v: pickle.dumps(v))
producer.send(topic = "test_topic", key = "hello", value = "world")\ producer.send(topic = "test_topic", key = "hello", value = "world")\
.add_callback(on_send_success).add_errback(on_send_error) .add_callback(on_send_success).add_errback(on_send_error)
producer.flush() producer.flush()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment