Skip to content

Instantly share code, notes, and snippets.

@hisplan
Last active December 22, 2015 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hisplan/d9378ce63733d06c8b4c to your computer and use it in GitHub Desktop.
Save hisplan/d9378ce63733d06c8b4c to your computer and use it in GitHub Desktop.
Python Kafka Producer
from kafka import SimpleProducer, KafkaClient
kafka = KafkaClient('localhost:9092')
producer = SimpleProducer(kafka)
producer.send_messages(b'my-topic', b'some message')
producer.send_messages(b'my-topic', b'this method', b'is variadic')
producer.send_messages(b'my-topic', u'안녕?'.encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment