Skip to content

Commit

Permalink
Merge pull request #2 from gmunozfe/incubator-kie-issues-1682-redpanda
Browse files Browse the repository at this point in the history
Fix advertise-kafka-addr in script command
  • Loading branch information
tkobayas authored Dec 12, 2024
2 parents 907dd10 + 996af44 commit 2818109
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ public KogitoKafkaContainer() {
@Override
protected void containerIsStarting(InspectContainerResponse containerInfo, boolean reused) {
super.containerIsStarting(containerInfo, reused);
String brokerAdvertisedListener = brokerAdvertisedListener(containerInfo);

// Start and configure the advertised address
String command = "#!/bin/bash\n";
command += "/usr/bin/rpk redpanda start --check=false --node-id 0 --smp 1 ";
command += "--memory 1G --overprovisioned --reserve-memory 0M ";
command += "--kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 ";
command += format("--advertise-kafka-addr %s ", String.join(",", getBootstrapServers(), brokerAdvertisedListener));
command += "--advertise-kafka-addr PLAINTEXT://kafka:29092,OUTSIDE://" + getHost() + ":" + getMappedPort(KAFKA_PORT) + " ";
command += "--set redpanda.enable_idempotence=true ";
command += "--set redpanda.enable_transactions=true ";

Expand All @@ -73,10 +72,6 @@ public void start() {
LOGGER.info("Kafka servers: {}", getBootstrapServers());
}

protected String brokerAdvertisedListener(InspectContainerResponse containerInfo) {
return String.format("PLAINTEXT://%s:29092", containerInfo.getConfig().getHostName());
}

public String getBootstrapServers() {
return format("OUTSIDE://%s:%d", getHost(), getMappedPort(KAFKA_PORT));
}
Expand Down

0 comments on commit 2818109

Please sign in to comment.