Kemux stream Processor classes
Base class for Processor classes.
Processor
dataclass
Processor base Class
Provides a common interface for Processor classes to read and write data to or from Kafka topics.
| Attributes: |
|
|---|
initialize_handler(app)
classmethod
Initialize the Faust topic handler for the Kafka topic.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Input Processor
Base class for stream input classes.
InputProcessor
dataclass
Bases: Processor
InputProcessor Class
Provides a common interface for stream input classes to read data from Kafka topic.
ingest(message)
staticmethod
Ingest a message from a Kafka topic. Must be implemented by user when defining a stream input. This is done instead of enforcing implementation via abstract classes, due to the fact that this class is never instantiated directly, but rather used as an interface.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
Output Processor
Base class for stream output classes.
OutputProcessor
dataclass
Bases: Processor
OutputProcessor Class
Provides a common interface for stream output classes to write data to Kafka topic.
declare()
async
classmethod
Declare the output topic and send an init message.
The init message is used to ensure that the topic is created before any messages are sent. It is always sent as the first message to the topic with the following structure:
{
'__kemux_init__': <current datetime in ISO format>
}
| Raises: |
|
|---|
filter(message)
staticmethod
Check if a message qualifies for the output topic. Must be implemented by user when defining a stream output. This is done instead of enforcing implementation via abstract classes, due to the fact that this class is never instantiated directly, but rather used as an interface.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
send(message)
async
classmethod
Send a message to the output topic.
| Parameters: |
|
|---|