Skip to content

Support multiple Kafka broker addresses in endpoint URL#806

Open
badaverse wants to merge 1 commit intotidwall:masterfrom
badaverse:feat/kafka-multiple-brokers
Open

Support multiple Kafka broker addresses in endpoint URL#806
badaverse wants to merge 1 commit intotidwall:masterfrom
badaverse:feat/kafka-multiple-brokers

Conversation

@badaverse
Copy link
Copy Markdown

@badaverse badaverse commented Apr 9, 2026

Please ensure you adhere to every item in this list

  • This PR was pre-approved by the project maintainer
  • I have self-reviewed the code
  • I have added all necessary tests

Describe your changes

Summary

  • Add multiple broker support for Kafka endpoints using comma-separated addresses (kafka://broker1:9092,broker2:9092/topic)
  • Update SETHOOK URL split logic to correctly distinguish Kafka broker commas from endpoint fallback commas
  • Replace single Host/Port fields with Brokers []string in the Kafka endpoint struct

Changes

  • internal/endpoint/endpoint.go: Replace Host string + Port int with Brokers []string in the Kafka struct. Update the URL parser to split the host portion on commas and collect each host:port pair into the slice.
  • internal/endpoint/kafka.go: Pass conn.ep.Kafka.Brokers directly to sarama.NewSyncProducer instead of constructing a single URI string.
  • internal/server/hooks.go: Introduce splitEndpointURLs() to replace naive comma splitting. Parts without a scheme prefix (:// or Endpoint=) are joined back to the preceding URL, so kafka://b1:9092,b2:9092/topic,http://backup/hook correctly splits into two endpoints.

Backward compatibility

  • Single broker URLs (kafka://host:9092/topic) continue to work as before.
  • Existing SETHOOK fallback behavior with multiple endpoints is preserved.

Issue number and link

#805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant