Skip to content

Instantly share code, notes, and snippets.

@dsbaars
Created January 17, 2015 15:59
Show Gist options
  • Save dsbaars/6f0cbca136898da17ae0 to your computer and use it in GitHub Desktop.
Save dsbaars/6f0cbca136898da17ae0 to your computer and use it in GitHub Desktop.
Tweets Producer
from kafka import KafkaClient, SimpleProducer, SimpleConsumer
kafka = KafkaClient("bigdatavm:9092")
producer = SimpleProducer(kafka)
data = []
f = open('part0.txt', 'rU')
lines = f.read().splitlines()
for line in lines:
producer.send_messages("worldcup", line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment