providers.akafka.KafkaEventPublisher

Apache Kafka specific event publishing provider.

Usage

Source

providers.akafka.KafkaEventPublisher()

Methods

Name Description
__init__() Please do not call directly! Should be called by the construct method.
construct() Setup and teardown KafkaEventPublisher instance with some config params.

__init__()

Please do not call directly! Should be called by the construct method.

Usage

Source

__init__(*, producer, generate_correlation_id)

Parameters

producer

hands over a started AIOKafkaProducer.

generate_correlation_id

whether to throw an error or generate a new ID if no correlation ID is set for the context when trying to publish an event. An invalid ID will result in an error in either case.


construct()

Setup and teardown KafkaEventPublisher instance with some config params.

Usage

Source

construct(*, config, kafka_producer_cls=AIOKafkaProducer)
Parameters
config: KafkaConfig

Config parameters needed for connecting to Apache Kafka.

kafka_producer_cls: type[KafkaProducerCompatible] = AIOKafkaProducer
Overwrite the used Kafka Producer class. Only intended for unit testing.