What are you trying to do?
Add optional constructor parameters to KafkaContainer to allow configuring the Kafka listener name and its security protocol, instead of hard-coding PLAINTEXT. This enables users to run Kafka containers with alternative listener names (for example SASL_PLAINTEXT or SSL) while still using the same container abstraction.
Why should it be done this way?
The current implementation always advertises PLAINTEXT as the client-facing listener and protocol, which limits test scenarios that need different listener naming or security configurations. By exposing listener_name and security_protocol as explicit parameters, the default behaviour remains unchanged, but users can opt into more realistic Kafka setups without overriding internal attributes or reimplementing container startup logic.
This approach aligns directly with Kafka’s own configuration model (KAFKA_LISTENERS and KAFKA_LISTENER_SECURITY_PROTOCOL_MAP) and keeps the change small, and backwards compatible.
What are you trying to do?
Add optional constructor parameters to
KafkaContainerto allow configuring the Kafka listener name and its security protocol, instead of hard-codingPLAINTEXT. This enables users to run Kafka containers with alternative listener names (for exampleSASL_PLAINTEXTorSSL) while still using the same container abstraction.Why should it be done this way?
The current implementation always advertises
PLAINTEXTas the client-facing listener and protocol, which limits test scenarios that need different listener naming or security configurations. By exposinglistener_nameandsecurity_protocolas explicit parameters, the default behaviour remains unchanged, but users can opt into more realistic Kafka setups without overriding internal attributes or reimplementing container startup logic.This approach aligns directly with Kafka’s own configuration model (
KAFKA_LISTENERSandKAFKA_LISTENER_SECURITY_PROTOCOL_MAP) and keeps the change small, and backwards compatible.