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

Method findCoordinator

conn.go:318–340  ·  view source on GitHub ↗

findCoordinator finds the coordinator for the specified group or transaction See http://kafka.apache.org/protocol.html#The_Messages_FindCoordinator

(request findCoordinatorRequestV0)

Source from the content-addressed store, hash-verified

316//
317// See http://kafka.apache.org/protocol.html#The_Messages_FindCoordinator
318func (c *Conn) findCoordinator(request findCoordinatorRequestV0) (findCoordinatorResponseV0, error) {
319 var response findCoordinatorResponseV0
320
321 err := c.readOperation(
322 func(deadline time.Time, id int32) error {
323 return c.writeRequest(findCoordinator, v0, id, request)
324
325 },
326 func(deadline time.Time, size int) error {
327 return expectZeroSize(func() (remain int, err error) {
328 return (&response).readFrom(&c.rbuf, size)
329 }())
330 },
331 )
332 if err != nil {
333 return findCoordinatorResponseV0{}, err
334 }
335 if response.ErrorCode != 0 {
336 return findCoordinatorResponseV0{}, Error(response.ErrorCode)
337 }
338
339 return response, nil
340}
341
342// heartbeat sends a heartbeat message required by consumer groups
343//

Callers

nothing calls this directly

Calls 5

readOperationMethod · 0.95
writeRequestMethod · 0.95
expectZeroSizeFunction · 0.85
ErrorTypeAlias · 0.70
readFromMethod · 0.45

Tested by

no test coverage detected