Skip to content

Conversation

ThomasKasene
Copy link

KafkaContainer and ConfluentKafkaContainer both have a pair of HashSet properties: listeners and advertisedListeners. At some point, these are being fed into KafkaHelper.resolveListeners(GenericContainer<?>, Set<String>) and KafkaHelper.resolveAdvertisedListeners(Set<Supplier<String>>) to help generate values for KAFKA_LISTENERS and KAFKA_ADVERTISED_LISTENERS, respectively. Each registered listener will get assigned the protocol TC-<X> where <X> essentially is the index position of the listener in each HashSet, but since HashSet doesn't guarantee any such order, a listener might be registered as TC-0 in the KAFKA_LISTENERS env variable and as TC-1 in KAFKA_ADVERTISED_LISTENERS.

The least intrusive solution I could think of was to replace HashSet with LinkedHashSet, which does guarantee insertion order, and should therefore work better with the way the KafkaHelper methods are designed.

@ThomasKasene ThomasKasene requested a review from a team as a code owner October 2, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant