key filter kafka

class KafkaKeyFilter(app, pipeline, keys, id=None, config=None)[source]

Bases: Processor

KafkaKeyFilter reduces the incoming event stream from Kafka based on a key provided in each event.

Every Kafka message has a key, KafkaKeyFilter selects only those events where the event key matches one of provided ‘keys’, other events will be discarded.

Set filtering keys as a parameter (in bytes) in the KafkaKeyFilter constructor.

KafkaKeyFilter is meant to be inserted after KafkaSource in a Pipeline.

__init__(app, pipeline, keys, id=None, config=None)[source]

Initializes variables

Parameters

appApplication

Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html`_.

pipelinePipeline

Name of the Pipeline.

keysbytes

keys used to filter out events from the event stream.

id : , default = None

configJSON, default = None

configuration file in JSON

KafkaKeyFilter.process(context, event)[source]

Does the filtering processed based on passed key variable.

Parameters

contextContext

additional information passed to the method

event : any type,a single unit of information that flows through the Pipeline.