Last active
May 2, 2017 15:44
-
-
Save rinatio/a0cc7f786e260d57714ce7a414c58403 to your computer and use it in GitHub Desktop.
Test python-kafka issue #601 https://github.com/dpkp/kafka-python/issues/601
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 random import randint | |
import kafka | |
from kafka import KafkaConsumer | |
BOOTSTRAP_SERVERS = '127.0.0.1:9092' | |
topic_name = 'test_topic' + str(randint(0, pow(10, 10))) | |
print(topic_name) | |
def option1(): | |
consumer = KafkaConsumer(bootstrap_servers=BOOTSTRAP_SERVERS) | |
consumer.subscribe(topics=[topic_name]) | |
consumer.poll() | |
consumer.seek_to_end() | |
def option2(): | |
consumer = KafkaConsumer(topic_name, bootstrap_servers=BOOTSTRAP_SERVERS) | |
consumer.poll() | |
consumer.seek_to_end() | |
def option3(): | |
consumer = KafkaConsumer(bootstrap_servers=BOOTSTRAP_SERVERS, group_id=None) | |
consumer.subscribe(topics=[topic_name]) | |
consumer.poll() | |
consumer.seek_to_end() | |
def option4(): | |
consumer = KafkaConsumer(topic_name, group_id=None, bootstrap_servers=BOOTSTRAP_SERVERS) | |
consumer.poll() | |
consumer.seek_to_end() | |
def option5(): | |
consumer = KafkaConsumer(topic_name, group_id=None, bootstrap_servers=BOOTSTRAP_SERVERS) | |
consumer.seek_to_end() | |
def option6(): | |
consumer = KafkaConsumer( | |
topic_name, | |
bootstrap_servers=BOOTSTRAP_SERVERS, | |
group_id=None, | |
auto_offset_reset='latest' | |
) | |
consumer.poll() | |
consumer.seek_to_end() | |
option1() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment