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")
#   class KafkaProperties(timeplus.base.Base):
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.

#   KafkaProperties()
View Source
20    def __init__(self):
21        Base.__init__(self)
22        self.prop("data_type", "json")
#   def topic(self, *args):
View Source
24    def topic(self, *args):
25        return self.prop("topic", *args)
#   def brokers(self, *args):
View Source
27    def brokers(self, *args):
28        return self.prop("brokers", *args)
#   def data_type(self, *args):
View Source
30    def data_type(self, *args):
31        return self.prop("data_type", *args)
#   def sasl(self, *args):
View Source
34    def sasl(self, *args):
35        return self.prop("sasl", *args)
#   def username(self, *args):
View Source
37    def username(self, *args):
38        return self.prop("username", *args)
#   def password(self, *args):
View Source
40    def password(self, *args):
41        return self.prop("password", *args)
#   def group(self, *args):
View Source
43    def group(self, *args):
44        return self.prop("group", *args)
#   def offset(self, *args):
View Source
47    def offset(self, *args):
48        return self.prop("offset", *args)
#   def partition_number(self, *args):
View Source
50    def partition_number(self, *args):
51        return self.prop("partition_number", *args)
#   def replication_factor(self, *args):
View Source
53    def replication_factor(self, *args):
54        return self.prop("replication_factor", *args)
Inherited Members
timeplus.base.Base
prop
data
id
#   class KafkaSource(timeplus.source.Source):
View Source
57class KafkaSource(Source):
58    """
59    KafkaSource class defines kafka source.
60    """
61
62    def __init__(self, env=None):
63        Source.__init__(self, env)
64        self.type("kafka")

KafkaSource class defines kafka source.

#   KafkaSource(env=None)
View Source
62    def __init__(self, env=None):
63        Source.__init__(self, env)
64        self.type("kafka")
#   class KafkaSink(timeplus.sink.Sink):
View Source
67class KafkaSink(Sink):
68    """
69    KafkaSink class defines kafka sink.
70    """
71
72    def __init__(self):
73        Sink.__init__(self)
74        self.type("kafka")

KafkaSink class defines kafka sink.

#   KafkaSink()
View Source
72    def __init__(self):
73        Sink.__init__(self)
74        self.type("kafka")