MCPcopy
hub / github.com/segmentio/kafka-go / makeConnect

Function makeConnect

consumergroup.go:878–894  ·  view source on GitHub ↗

connect returns a connection to ANY broker.

(config ConsumerGroupConfig)

Source from the content-addressed store, hash-verified

876
877// connect returns a connection to ANY broker.
878func makeConnect(config ConsumerGroupConfig) func(dialer *Dialer, brokers ...string) (coordinator, error) {
879 return func(dialer *Dialer, brokers ...string) (coordinator, error) {
880 var err error
881 for _, broker := range brokers {
882 var conn *Conn
883 if conn, err = dialer.Dial("tcp", broker); err == nil {
884 return &timeoutCoordinator{
885 conn: conn,
886 timeout: config.Timeout,
887 sessionTimeout: config.SessionTimeout,
888 rebalanceTimeout: config.RebalanceTimeout,
889 }, nil
890 }
891 }
892 return nil, err // err will be non-nil
893 }
894}
895
896// coordinator establishes a connection to the coordinator for this consumer
897// group.

Callers 1

ValidateMethod · 0.85

Calls 1

DialMethod · 0.45

Tested by

no test coverage detected