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
"""
kafka

This module defines kafka sink and source class
:copyright: (c) 2022 by Timeplus
:license: Apache2, see LICENSE for more details.
"""


from timeplus.base import Base
from timeplus.source import Source
from timeplus.sink import Sink


class KafkaProperties(Base):
    """
    KafkaProperties class defines kafka source properties.
    """

    def __init__(self):
        Base.__init__(self)
        self.prop("data_type", "json")

    def topic(self, *args):
        return self.prop("topic", *args)

    def brokers(self, *args):
        return self.prop("brokers", *args)

    # none, plain or scram
    def sasl(self, *args):
        return self.prop("sasl", *args)

    def username(self, *args):
        return self.prop("username", *args)

    def password(self, *args):
        return self.prop("password", *args)

    def group(self, *args):
        return self.prop("group", *args)

    # `latest` or `earlist`
    def offset(self, *args):
        return self.prop("offset", *args)

    def partition_number(self, *args):
        return self.prop("partition_number", *args)

    def replication_factor(self, *args):
        return self.prop("replication_factor", *args)


class KafkaSource(Source):
    """
    KafkaSource class defines kafka source.
    """

    def __init__(self, env=None):
        Source.__init__(self, env)
        self.type("kafka")


class KafkaSink(Sink):
    """
    KafkaSink class defines kafka sink.
    """

    def __init__(self):
        Sink.__init__(self)
        self.type("kafka")
#   class KafkaProperties(timeplus.base.Base):
View Source
class KafkaProperties(Base):
    """
    KafkaProperties class defines kafka source properties.
    """

    def __init__(self):
        Base.__init__(self)
        self.prop("data_type", "json")

    def topic(self, *args):
        return self.prop("topic", *args)

    def brokers(self, *args):
        return self.prop("brokers", *args)

    # none, plain or scram
    def sasl(self, *args):
        return self.prop("sasl", *args)

    def username(self, *args):
        return self.prop("username", *args)

    def password(self, *args):
        return self.prop("password", *args)

    def group(self, *args):
        return self.prop("group", *args)

    # `latest` or `earlist`
    def offset(self, *args):
        return self.prop("offset", *args)

    def partition_number(self, *args):
        return self.prop("partition_number", *args)

    def replication_factor(self, *args):
        return self.prop("replication_factor", *args)

KafkaProperties class defines kafka source properties.

#   KafkaProperties()
View Source
    def __init__(self):
        Base.__init__(self)
        self.prop("data_type", "json")
#   def topic(self, *args):
View Source
    def topic(self, *args):
        return self.prop("topic", *args)
#   def brokers(self, *args):
View Source
    def brokers(self, *args):
        return self.prop("brokers", *args)
#   def sasl(self, *args):
View Source
    def sasl(self, *args):
        return self.prop("sasl", *args)
#   def username(self, *args):
View Source
    def username(self, *args):
        return self.prop("username", *args)
#   def password(self, *args):
View Source
    def password(self, *args):
        return self.prop("password", *args)
#   def group(self, *args):
View Source
    def group(self, *args):
        return self.prop("group", *args)
#   def offset(self, *args):
View Source
    def offset(self, *args):
        return self.prop("offset", *args)
#   def partition_number(self, *args):
View Source
    def partition_number(self, *args):
        return self.prop("partition_number", *args)
#   def replication_factor(self, *args):
View Source
    def replication_factor(self, *args):
        return self.prop("replication_factor", *args)
Inherited Members
timeplus.base.Base
prop
data
id
#   class KafkaSource(timeplus.source.Source):
View Source
class KafkaSource(Source):
    """
    KafkaSource class defines kafka source.
    """

    def __init__(self, env=None):
        Source.__init__(self, env)
        self.type("kafka")

KafkaSource class defines kafka source.

#   KafkaSource(env=None)
View Source
    def __init__(self, env=None):
        Source.__init__(self, env)
        self.type("kafka")
#   class KafkaSink(timeplus.sink.Sink):
View Source
class KafkaSink(Sink):
    """
    KafkaSink class defines kafka sink.
    """

    def __init__(self):
        Sink.__init__(self)
        self.type("kafka")

KafkaSink class defines kafka sink.

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