Querying App Consumption Status

Function

This API is used to query the consumption status of an app.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/apps/{app_name}/streams/{stream_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

app_name

Yes

String

Name of the app to be queried

stream_name

Yes

String

Name of the stream to be queried

Maximum: 60

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Max. number of partitions to list in a single API call. The minimum value is 1 and the maximum value is 1,000. The default value is 100.

Minimum: 1

Maximum: 1000

Default: 100

start_partition_id

No

String

Name of the partition to start the partition list with. The returned partition list does not contain this partition.

checkpoint_type

Yes

String

Type of the checkpoint.

  • LAST_READ: Only sequence numbers are recorded in databases.

Enumeration values:

  • LAST_READ

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

has_more

Boolean

Whether there are more matching consumer applications.

  • true: yes

  • false: no

stream_name

String

Name of the stream to be queried

Maximum: 64

app_name

String

Name of the consumer application to be queried

partition_consuming_states

Array of PartitionConsumingStates objects

Consumption status of the current partition

Table 5 PartitionConsumingStates

Parameter

Type

Description

partition_id

String

Partition identifier of the stream.Two partition ID formats are available:- shardId-0000000000- 0For example, if a stream has three partitions, the partition IDs are 0, 1, and 2, or shardId-0000000000, shardId-0000000001, and shardId-0000000002.

sequence_number

String

Sequence number to be submitted, which is used to record the consumption checkpoint of the stream. Ensure that the sequence number is within the valid range.

latest_offset

Long

Latest index position

earliest_offset

Long

Earliest index position

checkpoint_type

String

Type of the checkpoint.

  • LAST_READ: Only sequence numbers are recorded in databases.

Enumeration values:

  • LAST_READ

status

String

Current status of the partition

  • CREATING

  • ACTIVE

  • DELETED

  • EXPIRED

Enumeration values:

  • CREATING

  • ACTIVE

  • DELETED

  • EXPIRED

Example Requests

Querying App Consumption Status

GET https://{Endpoint}/v2/{project_id}/apps/{app_name}/streams/{stream_name}

Example Responses

Status code: 200

Normal response

{
  "has_more" : false,
  "stream_name" : "disMonitorTest",
  "app_name" : "4aSiZ",
  "partition_consuming_states" : [ {
    "partition_id" : 0,
    "sequence_number" : -1,
    "latest_offset" : 1658297359,
    "earliest_offset" : 1653120573,
    "checkpoint_type" : "LAST_READ",
    "status" : "ACTIVE"
  } ]
}

Status Codes

Status Code

Description

200

Normal response

Error Codes

See Error Codes.