LocalRedpandaBroker
fastkafka.testing.LocalRedpandaBroker​
View sourceLocalRedpandaBroker class, used for running unique redpanda brokers in tests to prevent topic clashing.
init​
View source__init__(
self,
topics=[],
retries=3,
apply_nest_asyncio=False,
listener_port=9092,
tag='v23.1.2',
seastar_core=1,
memory='1G',
mode='dev-container',
default_log_level='debug',
kwargs,
)
Initialises the LocalRedpandaBroker object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
topics | Iterable[str] | List of topics to create after sucessfull redpanda broker startup | [] |
retries | int | Number of retries to create redpanda service | 3 |
apply_nest_asyncio | bool | set to True if running in notebook | False |
listener_port | int | Port on which the clients (producers and consumers) can connect | 9092 |
tag | str | Tag of Redpanda image to use to start container | 'v23.1.2' |
seastar_core | int | Core(s) to use byt Seastar (the framework Redpanda uses under the hood) | 1 |
memory | str | The amount of memory to make available to Redpanda | '1G' |
mode | str | Mode to use to load configuration properties in container | 'dev-container' |
default_log_level | str | Log levels to use for Redpanda | 'debug' |
get_service_config_string​
View sourceget_service_config_string(
self, service, data_dir
)
Generates a configuration for a service
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_dir | Path | Path to the directory where the zookeepeer instance will save data | required |
service | str | "redpanda", defines which service to get config string for | required |
is_started​
View source@property
is_started(
self
)
Property indicating whether the LocalRedpandaBroker object is started.
The is_started property indicates if the LocalRedpandaBroker object is currently in a started state. This implies that Redpanda docker container has sucesfully started and is ready for handling events.
Returns:
Type | Description |
---|---|
bool | True if the object is started, False otherwise. |
start​
View sourcestart(
self
)
Starts a local redpanda broker instance synchronously
Returns:
Type | Description |
---|---|
str | Redpanda broker bootstrap server address in string format: add:port |
stop​
View sourcestop(
self
)
Stops a local redpanda broker instance synchronously