Querying a Stream List¶
Initialize a DIS client instance named dic. For details, see Initializing a DIS Client.
Use the DIS SDK to list active streams.
Use the setLimit method to set the number of streams returned each time. If setLimit is not specified, a maximum of 10 streams are returned by default.
ListStreamsRequest listStreamsRequest = new ListStreamsRequest();
listStreamsRequest.setLimit(5);
System.out.println("listStream: " + JsonUtils.objToJson(dic.listStreams(listStreamsRequest)));
The returned stream list is as follows:
listStream: {"total_number":20,"stream_names":["Stream0","Stream1","Stream2","Stream3","Stream4"],"has_more_streams":true}