mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-22 15:32:48 +00:00
MINOR: Kafka handle test connection if Schema Registry not passed (#15250)
This commit is contained in:
parent
62c0cc7563
commit
eac40862ec
@ -226,7 +226,9 @@ class CommonBrokerSource(MessagingServiceSource, ABC):
|
|||||||
if topic_entity and self.generate_sample_data:
|
if topic_entity and self.generate_sample_data:
|
||||||
topic_name = topic_details.topic_name
|
topic_name = topic_details.topic_name
|
||||||
sample_data = []
|
sample_data = []
|
||||||
|
messages = None
|
||||||
try:
|
try:
|
||||||
|
if self.consumer_client:
|
||||||
self.consumer_client.subscribe(
|
self.consumer_client.subscribe(
|
||||||
[topic_name], on_assign=on_partitions_assignment_to_consumer
|
[topic_name], on_assign=on_partitions_assignment_to_consumer
|
||||||
)
|
)
|
||||||
|
@ -41,6 +41,12 @@ class InvalidKafkaCreds(Exception):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class SchemaRegistryException(Exception):
|
||||||
|
"""
|
||||||
|
Class to indicate invalid schema registry not initialized
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
TIMEOUT_SECONDS = 10
|
TIMEOUT_SECONDS = 10
|
||||||
|
|
||||||
|
|
||||||
@ -134,9 +140,18 @@ def test_connection(
|
|||||||
"Please validate credentials and check if you are using correct security protocol"
|
"Please validate credentials and check if you are using correct security protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def schema_registry_test():
|
||||||
|
if client.schema_registry_client:
|
||||||
|
client.schema_registry_client.get_subjects()
|
||||||
|
else:
|
||||||
|
raise SchemaRegistryException(
|
||||||
|
"Schema Registry not initialized, please provide schema registry "
|
||||||
|
"credentials in case you want topic schema and sample data to be ingested"
|
||||||
|
)
|
||||||
|
|
||||||
test_fn = {
|
test_fn = {
|
||||||
"GetTopics": custom_executor,
|
"GetTopics": custom_executor,
|
||||||
"CheckSchemaRegistry": client.schema_registry_client.get_subjects,
|
"CheckSchemaRegistry": schema_registry_test,
|
||||||
}
|
}
|
||||||
|
|
||||||
test_connection_steps(
|
test_connection_steps(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user