Updated on 2024-10-25 GMT+08:00

Querying a Checkpoint

Initialize a DIS SDK client instance named dic. For details, see Initializing a DIS SDK Client Instance.

1
2
3
4
5
6
7
8
9
GetCheckpointRequest getCheckpointRequest = new GetCheckpointRequest();
//Specify the application name. (Note: setAppId is used in 1.3.0 and earlier versions, and setAppName is used in 1.3.1 and later versions.)
getCheckpointRequest.setAppName(appName);
getCheckpointRequest.setStreamName(streamName);
//Specify the partition No.
getCheckpointRequest.setPartitionId("0");
//Specify the checkpoint type.
getCheckpointRequest.setCheckpointType(CheckpointTypeEnum.LAST_READ.name());
System.out.println("getCheckpoint: " + JsonUtils.objToJson(dic.getCheckpoint(getCheckpointRequest)));

The returned checkpoint details are as follows:

1
2
getCheckpoint:
{"sequence_number": "10", "metadata": "metadata"}