AggregationTopic

class kafkaaggregator.topics.AggregationTopic(name: str)

Bases: kafkaaggregator.topics.Topic

Represents aggregation topics.

Sets the right Schema Registry URL for aggregation topics.

Parameters:name (str) – Name of the aggregation topic in Kafka.

Attributes Summary

logger

Methods 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 None if it is already registered.

Return type:

int or None