Send a heartbeat packet to the server for a specified consumer.
POST /logstores/{logstoreName}/consumergroups/{consumerGroupName}? type=heartbeat&consumer={consumer}
Request syntax
POST /logstores/<logstoreName>/consumergroups/<consumerGroup>? type=heartbeat&consumer=<consumer> HTTP/1.1
Authorization: <AuthorizationString>
x-log-bodyrawsize: 0
User-Agent: <UserAgent>
x-log-apiversion: 0.6.0
Host: <Project Endpoint>
x-log-signaturemethod: hmac-sha1
Date: <GMT Date>
Content-Type: application/json
Content-MD5: F58544E4D022CC28A93D0B7CC208A5AA
Content-Length: <ContentLength>
<shard ID list>
Request parameters
Attribute name | Type | Required or not | Description |
---|---|---|---|
logstoreName | string | Yes | The Logstore name, which must be unique in the same project. |
consumerGroup | string | Yes | Consumer group name, which must be unique under a project. |
consumer | string | Yes | Consumer. |
{Shard ID List} | array | Yes | ID list of shards being consumed. |
The HeartBeat interface does not have a specific request header. For details about public request headers of Log Service APIs, see Public request header.
Response headerThe HeartBeat interface does not have a specific response header. For details about public response headers of Log Service APIs, see Public response header.
Response elementIf a HeartBeat request is sent successfully, the HTTP status code 200 and the ID list of all shards consumed by the consumer are returned.
Error codeThe interface may return the following error codes in addition to Log Service API Common error codes:
HTTP status code | ErrorCode | ErrorMessage |
---|---|---|
400 | NotExistConsumerWithBody | non-exist consumer with non-empty body of heartbeat message |
404 | ProjectNotExist | The Project does not exist : {Project} |
404 | LogStoreNotExist | logstore {logstoreName} dose not exist |
404 | ConsumerGroupNotExist | consumer group not exist |
500 | InternalServerError | Specified Server Error Message |
The heartbeat packet is sent only when the connection between the consumer and the server is established.
Example
POST /logstores/my-logstore/consumergroups/consumer_group_test? type=heartbeat&consumer=consumer_1 HTTP/1.1
Authorization: LOG <yourAccessKeyId>:<yourSignature>
x-log-bodyrawsize: 0
User-Agent: sls-java-sdk-v-0.6.1
x-log-apiversion: 0.6.0
Host: my-project.cn-shanghai.log.aliyuncs.com
x-log-signaturemethod: hmac-sha1
Date: Sun, 06 May 2018 09:44:10 GMT
Content-Type: application/json
Content-MD5: 8D5162CA104FA7E79FE80FD92BB657FB
Content-Length: 3
Connection: Keep-Alive
[0]
HTTP/1.1 200
Server: nginx/1.12.1
Content-Type: application/json
Content-Length: 5
Connection: close
Access-Control-Allow-Origin: *
Date: Sun, 06 May 2018 09:44:11 GMT
x-log-requestid: 5AEECE6B1FFC0366B2553FB5
[0,1]