Querying Stream Details

Initialize a DIS client as instructed in Initializing a DIS SDK Client Instance.

Use the DIS SDK to query the details about a specified stream.

//Stream to be queried.
string streamName = "XXX"; 
//Start partition ID.
 string startPartitionId = "XXX";
//Max. number of partitions to list in a single API call.
int? limitPartitions =XXX;
  var request = new DescribeStreamRequest 
{
//Stream to be queried.
    StreamName = streamName 
};

            if (!string.IsNullOrWhiteSpace(startPartitionId))
            {
//Name of the partition to start the partition list with. The returned partition list does not contain this partition.
                request.StartPartitionId = startPartitionId;
            }

            if (limitPartitions != null)
            {
//Max. number of partitions to list in a single API call.
                request.LimitPartitions = limitPartitions.Value;
            }

After configuring DescribeStreamRequest, you can query the stream details by calling DescribeStream.

           response = dic.DescribeStream(request);
            var responseJson = JsonConvert.SerializeObject(response);
            Console.WriteLine(responseJson);
            return response;

Viewing Execution Results

Press Ctrl+F5. Information similar to the following is displayed:

{"stream_name":"dis-shawobs2","stream_id":"IY6gsAE3HEsBI7hvdBp","create_time":1531107213118,"last_modified_time":1531107213118,"retention_period":24,"status":"RUNNING","stream_type":"COMMON","partitions":[{"status":"ACTIVE","partition_id":"shardId-0000000000","hash_range":"[0 : 4611686018427387902]","sequence_number_range":"[0 : 0]"},{"status":"ACTIVE","partition_id":"shardId-0000000001","hash_range":"[4611686018427387903 : 9223372036854775807]","sequence_number_range":"[0 : 0]"}],"has_more_partitions":false}
Table 1 Description of response parameter DescribeStreamResult

Parameter

Type

Description

stream_name

String

Name of the stream.

stream_id

String

Unique identifier of the stream.

create_time

Long

Timestamp at which the stream was created.

last_modified_time

Long

Timestamp at which the stream was most recently modified.

retention_period

Int

Period of time for which data is retained in the stream.

status

String

Current status of the stream. Possible values:

  • CREATING
  • RUNNING
  • TERMINATING
  • FROZEN

stream_type

String

Stream type.

partitions

List<PartitionResult>

Partition list.

has_more_partitions

Boolean

Specify whether there are more matching partitions of the DIS stream to list.

  • true: There are such streams.
  • false: There are no such partitions.

Parameters in PartitionResult

status

String

Current status of the partition. Possible values:

  • CREATING
  • ACTIVE

partition_id

String

Unique identifier of the partition.

hash_range

String

Possible value range of the hash key used by the partition.

sequence_number_range

String

Sequence number range of the partition.