From 70ef70fb637f25a05d2d929121d3e5cdfd7e8035 Mon Sep 17 00:00:00 2001 From: marekpl Date: Tue, 30 Jul 2019 16:16:26 +0200 Subject: kafka topic partition definition kafka topic partition definition Issue-ID: DCAEGEN2-565 Signed-off-by: marekpl Change-Id: Iae72717b3da37c278d399eca4607c9ebd4bb6f75 --- robotframework-onap/ONAPLibrary/KafkaKeywords.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/robotframework-onap/ONAPLibrary/KafkaKeywords.py b/robotframework-onap/ONAPLibrary/KafkaKeywords.py index f5adce5..6cdf85f 100644 --- a/robotframework-onap/ONAPLibrary/KafkaKeywords.py +++ b/robotframework-onap/ONAPLibrary/KafkaKeywords.py @@ -91,7 +91,11 @@ class KafkaKeywords(object): group_id=cgn, request_timeout_ms=10001) - partitions = [TopicPartition(str(topic_name), 0), TopicPartition(str(topic_name), 1), TopicPartition(str(topic_name), 2)] + consumer.topics() + partition_set = consumer.partitions_for_topic(str(topic_name)) + partitions = [] + for val in partition_set: + partitions.append(TopicPartition(str(topic_name), val)) consumer.assign(partitions) last = consumer.end_offsets(partitions) offset = max(last.values()) -- cgit 1.2.3-korg