send_message_1.py 379 B

12345678910111213141516171819
  1. def main():
  2. producer = kafka_producer(bootstrap_servers=['localhost:9092'], topic="VideoStream")
  3. test_image = Image(
  4. image_data = b"this is just a test string",
  5. height = 10,
  6. width = 10
  7. )
  8. for frame in range(100):
  9. test_image.frame = frame
  10. producer.send(test_image)
  11. sleep(1)
  12. if __name__ == "__main__":
  13. main()