Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/ConfluentKafkaLibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import confluent_kafka
from confluent_kafka import ConsumerGroupState
from confluent_kafka.schema_registry import SchemaRegistryClient

try:
from confluent_kafka.schema_registry import SchemaRegistryClient
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = True
except ImportError:
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = False
raise ImportError("SchemaRegistry requires additional dependencies to be installed. \
Please install with 'pip install robotframework-confluentkafkalibrary[schemaregistry]'")

from confluent_kafka.admin import AdminClient, NewTopic, NewPartitions, ConfigResource
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
from .consumer import KafkaConsumer
Expand All @@ -9,11 +17,12 @@
from .version import VERSION

IMPORTS = KafkaConsumer, KafkaProducer, KafkaAdminClient
try:
from .serialization import Serializer, Deserializer
IMPORTS += Serializer, Deserializer
except ImportError:
pass
if _SCHEMA_REGISTRY_CLIENT_AVAILABLE:
try:
from .serialization import Serializer, Deserializer
IMPORTS += Serializer, Deserializer
except ImportError:
pass

#class ConfluentKafkaLibrary(KafkaConsumer, KafkaProducer, Serializer, Deserializer):
class ConfluentKafkaLibrary(*IMPORTS):
Expand Down