Skip to content

KAFKA-19443: test-common ClusterInstance should make it easy to have more listeners #20057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,17 @@ default Set<Integer> brokerIds() {

/**
* The broker connect string which can be used by clients for bootstrapping
* using the broker listenerName
*/
String bootstrapServers();

/**
* The broker connect string which can be used by clients for bootstrapping
* using an alternate listener
* @throws org.apache.kafka.common.KafkaException if listenerName is not defined
*/
String bootstrapServers(ListenerName listenerName);

/**
* The broker connect string which can be used by clients for bootstrapping to the controller quorum.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,15 @@ public Properties clientProperties() {
}

public String bootstrapServers() {
return bootstrapServers(nodes.brokerListenerName());
}

public String bootstrapServers(ListenerName listenerName) {
StringBuilder bld = new StringBuilder();
String prefix = "";
for (Entry<Integer, BrokerServer> entry : brokers.entrySet()) {
int brokerId = entry.getKey();
BrokerServer broker = entry.getValue();
ListenerName listenerName = nodes.brokerListenerName();
// The KafkaConfig#listeners method normalizes the listener name.
// The result from TestKitNodes#brokerListenerName method should be normalized as well,
// so that it matches the listener name in the KafkaConfig.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ public String bootstrapServers() {
return clusterTestKit.bootstrapServers();
}

@Override
public String bootstrapServers(ListenerName listenerName) {
return clusterTestKit.bootstrapServers(listenerName);
}

@Override
public String bootstrapControllers() {
return clusterTestKit.bootstrapControllers();
Expand Down
Loading