Topic¶
-
class
kafkaaggregator.topics.Topic(name: str, registry_url: str)¶ Bases:
objectTopic schema and interaction with the Schema Registry.
Parameters: - name (
str) – Name of a kafka topic. - registry_url (
str) – Schema Registry URL.
Attributes Summary
loggerMethods Summary
get_fields()Get topic fields. get_schema()Retrieve topic schema from the Schema Registry. register(schema)Register an Avro schema with the Schema Registry. Attributes Documentation
-
logger= <Logger kafkaaggregator (WARNING)>¶
Methods Documentation
-
get_fields() → List[kafkaaggregator.fields.Field]¶ Get topic fields.
Parses the topic Avro schema and returns a list of fields with Python types.
Returns: fields – List of topic fields. Return type: list[Field]
-
get_schema() → str¶ Retrieve topic schema from the Schema Registry.
Returns: schema – Avro schema. Return type: str
-
register(schema: str) → Optional[int]¶ Register an Avro schema with the Schema Registry.
If the schema is already register for this subject it does nothing.
Parameters: - subject (
str) – Name of the topic subject. - schema (
str) – Avro schema.
Returns: schema_id – Schema ID from the Schema Registry or
Noneif it is already registered.Return type: intorNone- subject (
- name (