Kafka (RP or Confluent) available from other TC or host #9122
-
| I have a situation where I need the kafka.* server from both another testcontainer and  There should be a simple way to either consider  A complication of this is the host forwarded port isn't available at this configuration time. Snippet of how I'm setting up my kafka instance: RedpandaContainer kafka = new RedpandaContainer(DockerImageName.parse("docker.redpanda.com/redpandadata/redpanda:v23.1.2"))
				.withNetwork(Network.SHARED)
				.withAccessToHost(true)
				.withNetworkAliases(KAFKA_DEVSERVICE_HOSTNAME)
//				.withListener(() -> "external://"+KAFKA_DEVSERVICE_HOSTNAME + ":9092")
				.withListener(() -> KAFKA_DEVSERVICE_HOSTNAME + ":9092")
				.withListener(() -> KAFKA_DEVSERVICE_HOSTNAME + ":9093")
				// { {external:{host: localhost, port: 32884}}, {internal:{host: 127.0.0.1, port: 9093}}} //snippet from logs of redpanda
//				.withEnv("REDPANDA_KAFKA_ADVERTISED_LISTENERS", String.format(
//						"internal://%s:9093,external://%s:9092",
//						KAFKA_DEVSERVICE_HOSTNAME,
//						KAFKA_DEVSERVICE_HOSTNAME
//					))
				; | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
| Hi, Have you checked the Testcontainers Redpanda docs  | 
Beta Was this translation helpful? Give feedback.
Hi, Have you checked the Testcontainers Redpanda docs
Register additional listenerandProduce/Consume via new listener?