AggregatedTopic

class kafkaaggregator.topics.AggregatedTopic(name: str)

Bases: Topic

Represents aggregated topics.

Sets the right Schema Registry URL for aggregated topics.

Parameters:

name (str) – Name of the aggregated 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

async get_fields() List[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]

async get_schema() str

Retrieve topic schema from the Schema Registry.

Returns:

schema – Avro schema.

Return type:

str

async 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