timeplus.kafka
kafka
This module defines kafka sink and source class
:copyright: (c) 2022 by Timeplus
:license: Apache2, see LICENSE for more details.
View Source
0""" 1kafka 2 3This module defines kafka sink and source class 4:copyright: (c) 2022 by Timeplus 5:license: Apache2, see LICENSE for more details. 6""" 7 8 9from timeplus.base import Base 10from timeplus.source import Source 11from timeplus.sink import Sink 12 13 14class KafkaProperties(Base): 15 """ 16 KafkaProperties class defines kafka source properties. 17 """ 18 19 def __init__(self): 20 Base.__init__(self) 21 self.prop("data_type", "json") 22 23 def topic(self, *args): 24 return self.prop("topic", *args) 25 26 def brokers(self, *args): 27 return self.prop("brokers", *args) 28 29 def data_type(self, *args): 30 return self.prop("data_type", *args) 31 32 # none, plain or scram 33 def sasl(self, *args): 34 return self.prop("sasl", *args) 35 36 def username(self, *args): 37 return self.prop("username", *args) 38 39 def password(self, *args): 40 return self.prop("password", *args) 41 42 def group(self, *args): 43 return self.prop("group", *args) 44 45 # `latest` or `earlist` 46 def offset(self, *args): 47 return self.prop("offset", *args) 48 49 def partition_number(self, *args): 50 return self.prop("partition_number", *args) 51 52 def replication_factor(self, *args): 53 return self.prop("replication_factor", *args) 54 55 56class KafkaSource(Source): 57 """ 58 KafkaSource class defines kafka source. 59 """ 60 61 def __init__(self, env=None): 62 Source.__init__(self, env) 63 self.type("kafka") 64 65 66class KafkaSink(Sink): 67 """ 68 KafkaSink class defines kafka sink. 69 """ 70 71 def __init__(self): 72 Sink.__init__(self) 73 self.type("kafka")
View Source
15class KafkaProperties(Base): 16 """ 17 KafkaProperties class defines kafka source properties. 18 """ 19 20 def __init__(self): 21 Base.__init__(self) 22 self.prop("data_type", "json") 23 24 def topic(self, *args): 25 return self.prop("topic", *args) 26 27 def brokers(self, *args): 28 return self.prop("brokers", *args) 29 30 def data_type(self, *args): 31 return self.prop("data_type", *args) 32 33 # none, plain or scram 34 def sasl(self, *args): 35 return self.prop("sasl", *args) 36 37 def username(self, *args): 38 return self.prop("username", *args) 39 40 def password(self, *args): 41 return self.prop("password", *args) 42 43 def group(self, *args): 44 return self.prop("group", *args) 45 46 # `latest` or `earlist` 47 def offset(self, *args): 48 return self.prop("offset", *args) 49 50 def partition_number(self, *args): 51 return self.prop("partition_number", *args) 52 53 def replication_factor(self, *args): 54 return self.prop("replication_factor", *args)
KafkaProperties class defines kafka source properties.
Inherited Members
View Source
KafkaSource class defines kafka source.
View Source
KafkaSink class defines kafka sink.