summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarekpl <marek.pondel@nokia.com>2019-07-30 16:16:26 +0200
committermarekpl <marek.pondel@nokia.com>2019-07-30 16:19:39 +0200
commit70ef70fb637f25a05d2d929121d3e5cdfd7e8035 (patch)
treed774ab0f7794822f63fbea0e5c53d0f6940bac61
parent0605e351036d386b9ca7282dee848b0ce1848274 (diff)
kafka topic partition definition
kafka topic partition definition Issue-ID: DCAEGEN2-565 Signed-off-by: marekpl <marek.pondel@nokia.com> Change-Id: Iae72717b3da37c278d399eca4607c9ebd4bb6f75
-rw-r--r--robotframework-onap/ONAPLibrary/KafkaKeywords.py6
1 files changed, 5 insertions, 1 deletions
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())