Creating a Stream That Has an OBS Dump Task (Discarded)
In earlier versions, you can add an OBS periodic dump task when creating a stream. This function has been discarded in new versions. For details about how to create a stream and add dump tasks for it, see Creating a DIS Stream and Adding a Dump Task.
Function
This API is used to create a stream.
Request
- Example request
POST https://{endpoint}/v2/{project_id}/streams { "stream_name": "obs_test", "partition_count": 1, "obs_destination_descriptor": [ { "agency_name": "agency", "obs_bucket_path": "1111", "file_prefix": "", "deliver_time_interval":300, "partition_format": "yyyy/MM/dd/HH/mm", "record_delimiter": "\n" } ] } - Parameter description
Table 1 Parameter description Parameter
Mandatory
Type
Description
stream_name
Yes
String
Name of the DIS stream.
Name of the DIS stream to be created. A stream name is 1 to 64 characters long. Only letters, digits, hyphens (-), and underscores (_) are allowed.
stream_type
No
String
Partition type.
Possible values:
- COMMON: a common stream. The bandwidth is 1 MB/s.
- ADVANCED: an advanced stream. The bandwidth is 5 MB/s.
Default value: COMMON
partition_count
Yes
Int
Number of the partitions.
Partitions are the base throughput unit of a DIS stream.
The value range varies depending on the value of stream_type.
- If stream_type is set to COMMON, the value of partition_count is an integer from 1 to 50. If a tenant has created N common partitions, then the tenant can create 50-N more common partitions.
- If stream_type is set to ADVANCED, the value of partition_count is an integer from 1 to 10. If a tenant has created N advanced partitions, then the tenant can create 10-N more advanced partitions.
data_duration
No
Int
Period of time for which data is retained in the DIS stream.
Value range: N x 24, where N is an integer from 1 to 7.
Unit: hour
Default value: 24
If this parameter is left unspecified, the default value will be used.
data_type
No
String
Source data type.
Possible values:- BLOB: binary data. Data of BLOB type can be stored in DIS or dumped to OBS, MRS, DWS, or DLI.
- JSON: data with a strong schema structure. Data of JSON type can be stored in DIS or dumped to CloudTable.
Default value: BLOB
obs_destination_descriptor
No
Object
Parameter list of the OBS to which data in the DIS stream will be dumped. Data in a DIS stream cannot be dumped to multiple destinations.
This parameter is left unspecified by default.
If this parameter is left unspecified, data is not dumped to OBS.
mrs_destination_descriptor
No
Object
Parameter list of the MRS to which data in the DIS stream will be dumped. Data in a DIS stream cannot be dumped to multiple destinations.
This parameter is left unspecified by default.
If this parameter is left unspecified, data is not dumped to MRS.
dli_destination_descriptor
No
Object
Parameter list of the DLI to which data in the DIS stream will be dumped. Data in a DIS stream cannot be dumped to multiple destinations.
This parameter is left unspecified by default.
If this parameter is left unspecified, data is not dumped to DLI.
cloudtable_destination_descriptor
No
Object
Parameter list of the CloudTable to which data in the DIS stream will be dumped.
Data in a DIS stream cannot be dumped to multiple destinations.
This parameter is left unspecified by default.
If this parameter is left unspecified, data is not dumped to CloudTable HBase or OpenTSDB.
dws_destination_descriptor
No
Object
Parameter list of the DWS to which data in the DIS stream will be dumped. Data in a DIS stream cannot be dumped to multiple destinations.
This parameter is left unspecified by default.
If this parameter is left unspecified, data is not dumped to DWS.
Table 2 obs_destination_descriptor parameter description Parameter
Mandatory
Type
Description
agency_name
Yes
String
Name of the agency created in IAM. DIS uses an agency to access your specified resources. Agency parameter settings:
- Agency Type: Cloud service
- Cloud Service: DIS
- Validity Period: Permanent
- Region: Global service Project: OBS Policy: Tenant Administrator
This parameter cannot be left unspecified and the parameter value cannot exceed 64 characters.
obs_bucket_path
Yes
String
Name of the OBS bucket used to store data from the DIS stream.
file_prefix
No
String
Directory to store files that will be dumped to OBS. Different directory levels are separated by slashes (/) and cannot start with slashes.
NOTE:- This parameter is optional if streaming data is dumped to OBS.
- This parameter is not required if small files are dumped to OBS.
A directory name cannot exceed 50 characters.
Only letters, digits, and underscores (_) are allowed.
The priority order is as follows:- file_prefix: high
- partition_format: medium
- DIS_generated_filename: low
deliver_time_interval
No
Int
User-defined interval at which data is imported from the current DIS stream into OBS. If no data is pushed to the DIS stream during the current interval, no dump file package will be generated.
NOTE:- This parameter is mandatory if streaming data is dumped to OBS.
- This parameter is not required if small files are dumped to OBS.
Value range: 30s to 900s
Default value: 300
Unit: second
partition_format
No
String
Directory structure of the object file written into OBS. The directory structure is in the format of yyyy/MM/dd/HH/mm (time at which the dump task was created).
- YYYY: year
- MM: month
- dd: day
- HH: hour
- mm: minute
For example, if the dump task was created at 14:49:00 on November 10, 2017, then the directory structure is . 2017 is the level-1 directory.
deliver_data_type
No
String
This parameter is mandatory if Dump Type is set to Custom file.
Default value: file_stream
record_delimiter
No
String
Delimiter for the dump file, which is used to separate the user data that is written into the dump file.
Possible values:- Comma (,)
- Semicolon (;)
- Vertical bar (|)
- Newline (\n)
- NULL
Default value: newline (\n)
- The data dumped to OBS is the raw data uploaded by users, that is, the data decoded using Base64.
- The records uploaded by users are separated by newline (\n).
Response
- If the DIS stream was successfully created, a 201 response with an empty response body is returned. For details about status codes, see Status Codes.
- If the DIS stream failed to be created, identify the failure cause according to the response body and the instructions in Error Codes.
Response Code
- Normal
- Failed
For more information, see Error Codes.
Last Article: Obtaining Stream Consumption Information
Next Article: Appendix
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.