doc-exports/docs/dis/umn/dis_06_0501.html
Xiong, Chen Xiao 1a4b9e91b7 DIS UMN test2 version
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>
2022-11-14 16:38:55 +00:00

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);