forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Xiong, Chen Xiao <chenxiaoxiong@huawei.com> Co-committed-by: Xiong, Chen Xiao <chenxiaoxiong@huawei.com>
1.9 KiB
1.9 KiB
Creating a Stream
Initialize a DIS client instance named dic. For details, see Initializing a DIS Client.
When you use the DIS SDK to create a DIS stream, specify the stream name, number of partitions in the stream, and stream type.
STREAM_TYPE_COMMON indicates a common stream, and STREAM_TYPE_ADVANCED indicates an advanced stream.
//Configure the channel name. String streamName = "myStream"; //Configure the number of partitions in the stream. Integer partitionCount = new Integer(3); CreateStreamRequest createStreamRequest = new CreateStreamRequest(); createStreamRequest.setStreamName(streamName); createStreamRequest.setPartitionCount(partitionCount); //Configure the stream type. createStreamRequest.setStreamType(CreateStreamRequest.STREAM_TYPE_COMMON);
After configuring CreateStreamRequest, you can create a stream by calling createStream.
dic.createStream(createStreamRequest);
Parent topic: DIS SDK Usage Guide