AioKafkaProducerDependency#

class kafkit.fastapi.dependencies.aiokafkaproducer.AioKafkaProducerDependency#

Bases: object

A FastAPI dependency that provides an aiokafka Producer.

Methods Summary

__call__()

Get the dependency (call during FastAPI request handling).

initialize(settings)

Initialize the dependency (call during FastAPI startup).

stop()

Stop the dependency (call during FastAPI shutdown).

Methods Documentation

async __call__()#

Get the dependency (call during FastAPI request handling).

Return type:

AIOKafkaProducer

async initialize(settings)#

Initialize the dependency (call during FastAPI startup).

Parameters:

settings (KafkaConnectionSettings) – The Kafka connection settings.

Return type:

None

async stop()#

Stop the dependency (call during FastAPI shutdown).

Return type:

None