API Reference

kafkaaggregator.app Module

Create a kafka-aggregator application.

Functions

create_app(config) Create and configure a Faust based kafka-aggregator application.

kafkaaggregator.fields Module

Aggregation field class.

The Field has a numerical type by construction. It also holds the name of the source field being aggregated and the operation performed.

Classes

Field(name, type, Type[float], Type[bytes], …) Represents an aggregation field with numeric types.

Class Inheritance Diagram

Inheritance diagram of kafkaaggregator.fields.Field

kafkaaggregator.topics Module

Implements Topic, SourceTopic and AggregationTopic classes.

The Topic class has methods to retrieve the topic schema from the Schema Registry and a parsed list of fields from the Avro schema with Python types.

The child classes SourceTopic and AggregationTopic set the right Schema Registry URL to be used with each topic type.

Classes

SchemaException A generic schema registry client exception.
Topic(name, registry_url) Topic schema and interaction with the Schema Registry.
SourceTopic(name) Represents source topics.
AggregationTopic(name) Represents aggregation topics.

Class Inheritance Diagram

Inheritance diagram of kafkaaggregator.topics.SchemaException, kafkaaggregator.topics.Topic, kafkaaggregator.topics.SourceTopic, kafkaaggregator.topics.AggregationTopic

kafkaaggregator.models Module

A class factory for Faust-avro Records.

Functions

make_record(cls_name, fields, doc) Create a Faust-avro Record subclass.

kafkaaggregator.aggregator Module

Create the aggregation model and compute summary statistics.

Given a source topic and a list of field names to exclude from aggregation create the aggregation model and compute summary statistics.

kafka-aggregator adds the aggregation fields time, window_size, and count and computes min, mean, stdev, median, and max statistics for every numeric field in the source topic.

Classes

Aggregator(source_topic_name, …) Create the aggregation model and compute summary statistics.

kafkaaggregator.generator Module

Generates Faust agents based on the agent.j2 template.

Classes

AgentGenerator() Generate Faust agents from a list of source topics.

kafkaaggregator.cli Module

Command-line interface for kafkaaggregator.

Functions

main() Entrypoint for Faust CLI.

Classes

produce(ctx, *args, key_serializer, str, …) Produce messages for the aggregation example.
init_example(ctx, *args, key_serializer, …) Initialize the source topic used in the aggregation example.

kafkaaggregator.example Module

Aggregation example.

Classes

AggregationExample() Initialize topics and produce messages for the aggregation example.
UnexpectedNumberOfTopicsError Raised when the number of source topics is unnexpected.

Class Inheritance Diagram

Inheritance diagram of kafkaaggregator.example.AggregationExample, kafkaaggregator.example.UnexpectedNumberOfTopicsError