Querying a Stream List
Use the DIS SDK to query active streams.
Use the Limit method to set the number of streams returned each time. If Limit is not specified, a maximum of 10 streams are returned by default.
char *projectId = "d575b0b740e54221aeb9a165653b103d";
char *region = "southchina";
char *service = "dis";
char *host = "XXX.XXX.XXX.XXX:XXX";
int ret = 0;
int i = 0;
DISResponseInfo RspInfo = {0};
DISListStream listStream = {0};
//Set the value to 2.
listStream.limit = 2;
//Query from the dis-shawn stream. The result does not contain this stream.
listStream.startStreamName = "dis-shawn";
printf("===================%s Begin=======================\n",__FUNCTION__);
ret = ListStream(host, projectId, region, &listStream, &RspInfo);
if(ret != 0)
{
printf("List Error: %d\r\n", ret);
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
printf("ErrorCode: %s\r\n", RspInfo.ErrorCode);
printf("ErrorDetail: %s\r\n", RspInfo.ErrorDetail);
return;
}
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
printf("the totalcount is %d, the current count is %d\r\n", listStream.streamListResult.totalNumber,
listStream.streamListResult.currentNumber);
printf("hasMoreStream: %ld\r\n", listStream.streamListResult.hasMoreStream);
printf("streamList include: ");
for (i = 0; i < listStream.streamListResult.currentNumber; i++)
{
printf("%s, ", listStream.streamListResult.streamList[i].streamName);
}
printf("\b\b \r\n");
printf("===================%s End=======================\n",__FUNCTION__);
|
Parameter |
Type |
Description |
|---|---|---|
|
limit |
long |
The maximum number of DIS streams to list in a single API call. Value range: 1-100 Default value: 10 |
|
startStreamName |
char * |
Name of the DIS stream to start the stream list with. The returned stream list does not contain this DIS stream name. |
Execution Result
Information similar to the following is displayed on the console:
HttpResponseCode: 200 the totalcount is 4, the current count is 2 hasMoreStream: 0 streamList include: dis-shawn-1, testmonit
|
Parameter |
Type |
Description |
|---|---|---|
|
streamListResult |
DISListStreamResult |
Stream list. |
|
Parameter |
Type |
Description |
|---|---|---|
|
totalNumber |
long |
Total number of all the DIS streams created by the current tenant. |
|
streamList |
DISStream [100] |
Name of the list of the streams meeting the current requests. |
|
hasMoreStream |
long |
Specify whether there are more matching DIS streams to list. Possible values: |
|
currentNumber |
long |
Number of streams that meet the current condition. |
|
Parameter |
Type |
Description |
|---|---|---|
|
streamName |
char [64] |
Stream name array. |
Last Article: Deleting a Stream
Next Article: Querying Stream Details
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.