bump
This commit is contained in:
36
test_kafka.py
Normal file
36
test_kafka.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from kafka import TopicPartition
|
||||
from kafka.structs import OffsetAndMetadata
|
||||
from CommonCode import kwq
|
||||
|
||||
input_topic = kwq.TOPICS.videos_to_score_detection
|
||||
producer = kwq.producer
|
||||
topic_produce = kwq.TOPICS.videos_scored_detection
|
||||
|
||||
|
||||
|
||||
client_id = 'hello_world2'
|
||||
group_id = client_id
|
||||
|
||||
|
||||
consumer = kwq.create_consumer(input_topic, group_id = group_id, client_id = client_id)
|
||||
|
||||
|
||||
c_part = TopicPartition(input_topic, 0)
|
||||
consumer.assign([c_part])
|
||||
|
||||
|
||||
|
||||
c_committed = consumer.committed(c_part)
|
||||
logger.info(f"KAFKA_POSITION_IS: {str(consumer.position(c_part))}")
|
||||
|
||||
if c_committed is None:
|
||||
logger.info(f"KAFKA_POSITION_NOT_COMMITTED")
|
||||
else:
|
||||
logger.info(f"KAFKA_POSITION_COMMITTED_IS: {c_committed}")
|
||||
consumer.seek(c_part, c_committed)
|
||||
logger.info("START POLLING")
|
||||
|
||||
# %%
|
||||
|
||||
for c in consumer:
|
||||
print(c.offset)
|
||||
Reference in New Issue
Block a user