in datahub/implement.go [1304:1339]
func (datahub *DataHub) Heartbeat(projectName, topicName, consumerGroup, consumerId string, versionId int64, holdShardList, readEndShardList []string) (*HeartbeatResult, error) {
if !util.CheckProjectName(projectName) {
return nil, NewInvalidParameterErrorWithMessage(projectNameInvalid)
}
if !util.CheckTopicName(topicName) {
return nil, NewInvalidParameterErrorWithMessage(topicNameInvalid)
}
for _, id := range holdShardList {
if !util.CheckShardId(id) {
return nil, NewInvalidParameterErrorWithMessage(shardIdInvalid)
}
}
for _, id := range readEndShardList {
if !util.CheckShardId(id) {
return nil, NewInvalidParameterErrorWithMessage(shardIdInvalid)
}
}
path := fmt.Sprintf(consumerGroupPath, projectName, topicName, consumerGroup)
reqPara := &RequestParameter{
Header: map[string]string{httpHeaderContentType: httpJsonContent},
}
hr := &HeartbeatRequest{
Action: "heartbeat",
ConsumerId: consumerId,
VersionId: versionId,
HoldShardList: holdShardList,
ReadEndShardList: readEndShardList,
}
respBody, commonResp, err := datahub.Client.Post(path, hr, reqPara)
if err != nil {
return nil, err
}
return NewHeartbeatResult(respBody, commonResp)
}