KafkaBrokerContext#
- class pytest_kafka_broker.KafkaBrokerContext(bootstrap_server)[source]#
Bases:
objectInformation and convenience methods for a temporary Kafka cluster.
This object is returned by
kafka_broker().Attributes Summary
Kafka bootstrap server in the form
host:port.Methods Summary
admin([config])Create a Kafka admin client connected to the cluster.
aio_consumer([config])Create an asynchronous Kafka consumer connected to the cluster.
aio_producer([config])Create an asynchronous Kafka producer connected to the cluster.
config([config])Get the configuration for a Kafka client.
consumer([config])Create a Kafka consumer connected to the cluster.
producer([config])Create a Kafka producer connected to the cluster.
Attributes Documentation
- Parameters:
bootstrap_server (str)
- bootstrap_server: str = <dataclasses._MISSING_TYPE object>#
Kafka bootstrap server in the form
host:port.
Methods Documentation
- admin(config=None)[source]#
Create a Kafka admin client connected to the cluster.
- Parameters:
config (dict | None) – Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
AdminClient
- aio_consumer(config=None)[source]#
Create an asynchronous Kafka consumer connected to the cluster.
- Parameters:
config (dict | None) –
Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
AIOConsumer
- aio_producer(config=None)[source]#
Create an asynchronous Kafka producer connected to the cluster.
- Parameters:
config (dict | None) –
Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
AIOProducer
- config(config=None)[source]#
Get the configuration for a Kafka client.
- Parameters:
config (dict | None) –
Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
- consumer(config=None)[source]#
Create a Kafka consumer connected to the cluster.
- Parameters:
config (dict | None) –
Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
Consumer
- producer(config=None)[source]#
Create a Kafka producer connected to the cluster.
- Parameters:
config (dict | None) –
Extra Kafka client configuration properties. See list in the librdkafka documentation.
- Return type:
Producer