Skip to main content
Version: 0.8.0

LocalRedpandaBroker

fastkafka.testing.LocalRedpandaBroker​

View source

LocalRedpandaBroker 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:

NameTypeDescriptionDefault
topicsIterable[str]List of topics to create after sucessfull redpanda broker startup[]
retriesintNumber of retries to create redpanda service3
apply_nest_asyncioboolset to True if running in notebookFalse
listener_portintPort on which the clients (producers and consumers) can connect9092
tagstrTag of Redpanda image to use to start container'v23.1.2'
seastar_coreintCore(s) to use byt Seastar (the framework Redpanda uses under the hood)1
memorystrThe amount of memory to make available to Redpanda'1G'
modestrMode to use to load configuration properties in container'dev-container'
default_log_levelstrLog levels to use for Redpanda'debug'

get_service_config_string​

View source
get_service_config_string(
self, service, data_dir
)

Generates a configuration for a service

Parameters:

NameTypeDescriptionDefault
data_dirPathPath to the directory where the zookeepeer instance will save datarequired
servicestr"redpanda", defines which service to get config string forrequired

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:

TypeDescription
boolTrue if the object is started, False otherwise.

start​

View source
start(
self
)

Starts a local redpanda broker instance synchronously

Returns:

TypeDescription
strRedpanda broker bootstrap server address in string format: add:port

stop​

View source
stop(
self
)

Stops a local redpanda broker instance synchronously