Skip to content

Commit

Permalink
Check node and broker id equality in KRaft mode on start up and not i…
Browse files Browse the repository at this point in the history
…n broker.id setter

Fixes #124
  • Loading branch information
fedinskiy committed Dec 20, 2024
1 parent b697d95 commit 85da96f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ protected void containerIsStarting(final InspectContainerResponse containerInfo,
this.nodeId = this.brokerId;
}

if (this.useKraft) {
if (this.brokerId != this.nodeId) {
throw new IllegalStateException("`broker.id` and `node.id` must have the same value!");
}
}

final String[] listenersConfig = this.buildListenersConfig(containerInfo);
final Properties defaultServerProperties = this.buildDefaultServerProperties(
listenersConfig[0],
Expand Down Expand Up @@ -654,10 +660,6 @@ public StrimziKafkaContainer withExternalZookeeperConnect(final String externalZ
* @return StrimziKafkaContainer instance
*/
public StrimziKafkaContainer withBrokerId(final int brokerId) {
if (this.useKraft && this.brokerId != this.nodeId) {
throw new IllegalStateException("`broker.id` and `node.id` must have same value!");
}

this.brokerId = brokerId;
return self();
}
Expand Down

0 comments on commit 85da96f

Please sign in to comment.