Skip to content

Instantly share code, notes, and snippets.

@brynmathias
Created July 30, 2018 07:38
Show Gist options
  • Save brynmathias/a5e1132e5706f0ba9f93e97d08c1e776 to your computer and use it in GitHub Desktop.
Save brynmathias/a5e1132e5706f0ba9f93e97d08c1e776 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from MessageCorps.broker import kafka_producer
from protobuf.data.ImageData_pb2 import Image
from time import sleep
import logging
logging.basicConfig(level=logging.DEBUG)
def main():
producer = kafka_producer(bootstrap_servers=['localhost:9092'], topic="VideoStream")
test_image = Image(
image_data = b"this is just a test string",
height = 10,
width = 10
)
for frame in range(100):
test_image.frame = frame
producer.send(test_image)
sleep(1)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment