Quantcast
Channel: Active questions tagged consumer - Stack Overflow
Viewing all articles
Browse latest Browse all 87

get results from kafka for a specific period of time

$
0
0

Here is my code, that uses kafka-python.

now = datetime.now()month_ago = now - relativedelta(month=1)topic = 'some_topic_name'consumer = KafkaConsumer(topic, bootstrap_servers=PROD_KAFKA_SERVER,                         security_protocol=PROTOCOL,                         group_id=GROUP_ID,                         enable_auto_commit=False,                         sasl_mechanism=SASL_MECHANISM, sasl_plain_username=SASL_USERNAME,                         sasl_plain_password=SASL_PASSWORD)for msg in consumer:    print(msg)

I want to get results from topic just between now and month_ago in a loop. How can I do this?

Thanks for any help!


Viewing all articles
Browse latest Browse all 87

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>