Adding a Checkpoint
Function
This API is used to add a checkpoint.
- When an application consumes data, the latest SN of the consumed data is recorded as a checkpoint. When the data is reconsumed, the consumption can be continued based on this checkpoint.
- An application and checkpoint are used together. When adding a checkpoint, you need to specify the stream name, partition ID, and application name.
Request
- Example request
POST https://{endpoint}/v2/{project_id}/checkpoints { "stream_name": "stream_name_test1", "app_name": "app_name1", "partition_id": "shardId-0000000000", "sequence_number": "10", "metadata": "metadata", "checkpoint_type": "LAST_READ" } - Parameter description
Table 1 Parameter description Parameter
Mandatory
Type
Description
stream_name
Yes
String
Name of the DIS stream whose data record will have a checkpoint.
A stream name is 1 to 64 characters long. Only letters, digits, hyphens (-), and underscores (_) are allowed.
app_name
Yes
String
Unique name of the consumer application that will read data from the chosen DIS stream.
An application name must contain 1 to 50 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
partition_id
Yes
String
Unique identifier of the partition.
sequence_number
Yes
String
Sequence number used to record the consumption checkpoint of the stream.
metadata
No
String
Metadata of the consumer application.
The maximum metadata length is 1000 characters.
checkpoint_type
Yes
String
Type of the checkpoint.
The checkpoint type LAST_READ indicates that only sequence numbers are recorded into the database.
Response
- If the DIS stream was successfully created, a 201 response with an empty response body is returned.
- If the DIS stream failed to be created, identify the failure cause according to the response body and the instructions in Error Codes.
Status Code
- Normal
- Failed
For more information, see Error Codes.
Last Article: Querying an Application List
Next Article: Querying a Checkpoint
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.