Created
April 9, 2020 10:57
-
-
Save VyBui/b3094d06bb3e52114535e3c763c8826f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from json import dumps | |
from kafka import KafkaProducer | |
BPS_models = '/home/vybt/Downloads/release_official/full_flow_test/models.txt' | |
producer = KafkaProducer(bootstrap_servers=['localhost:9092'], | |
value_serializer=lambda x: | |
dumps(x).encode('utf-8')) | |
txt_file = open(BPS_models, "r") | |
count = 0 | |
for person_url in txt_file: | |
data = {'imagePersonURL' : str(person_url), 'ownerId': int(count)} | |
count += 1 | |
print("sending ... {}".format(count)) | |
producer.send('bpsIn', value=data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment