Beispiel #1
0
 def get_topic_partitions(self, topic):
     self.consumer = KafkaConsumer(topic,
                                   bootstrap_servers=self.brokers,
                                   client_id=self.client_id,
                                   request_timeout_ms=self.timeout_ms)
     if topic not in self.get_topics():
         raise CriticalError(
             "topic '{0}' does not exist on Kafka broker".format(topic))
     partitions = self.consumer.partitions_for_topic(topic)
     assert isSet(partitions)
     return partitions
 def get_topic_partitions(self, topic):
     self.consumer = KafkaConsumer(
         topic,
         bootstrap_servers=self.brokers,
         client_id=self.client_id,
         request_timeout_ms=self.timeout_ms
         )
     if topic not in self.get_topics():
         raise CriticalError("topic '{0}' does not exist on Kafka broker".format(topic))
     partitions = self.consumer.partitions_for_topic(topic)
     assert isSet(partitions)
     return partitions
 def get_topic_partitions(self, topic):
     self.consumer = KafkaConsumer(
         topic,
         bootstrap_servers=self.brokers,
         client_id=self.client_id,
         #request_timeout_ms=self.timeout_ms
     )
     if topic not in self.get_topics():
         raise CriticalError(
             "topic '{0}' does not exist on Kafka broker".format(topic))
     partitions = self.consumer.partitions_for_topic(topic)
     if not isSet(partitions):
         raise UnknownError(
             'partitions returned type is {}, not a set as expected'.format(
                 type(partitions)))
     return partitions