Updated on 2024-10-21 GMT+08:00

Adding DLI Dump Tasks

Function

This API is used to add DLI dump tasks.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/streams/{stream_name}/transfer-tasks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

stream_name

Yes

String

Name of the stream

Maximum: 60

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

destination_type

Yes

String

Type of the dump task.

  • OBS: Data is dumped to OBS.

  • MRS: Data is dumped to MRS.

  • DLI: Data is dumped to DLI.

  • CLOUDTABLE: Data is dumped to CloudTable.

  • DWS: Data is dumped to DWS.

Default: NOWHERE

Enumeration values:

  • DLI

dli_destination_descriptor

No

DliDestinationDescriptorRequest object

Parameter list of the DLI to which data in the DIS stream will be dumped

Table 4 DliDestinationDescriptorRequest

Parameter

Mandatory

Type

Description

task_name

Yes

String

Name of the dump task. The task name consists of letters, digits, hyphens (-), and underscores (_). It contains 1 to 64 characters.

agency_name

Yes

String

Name of the agency created on IAM. DIS uses an agency to access your specified resources. Agency parameter settings:- Agency Type: Cloud service- Cloud Service: DIS- Validity Period: Unlimited- Set Policy to Tenant Administrator on the OBS project in the Global service region.If agencies are available, you can use an IAM API to obtain the available agencies.This parameter cannot be left unspecified and the parameter value cannot exceed 64 characters.If there are dump tasks on the console, the system displays a message indicating that an agency will be automatically created. The name of the automatically created agency is dis_admin_agency.

Maximum: 64

deliver_time_interval

Yes

Integer

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.

Unit: second

Minimum: 30

Maximum: 900

Default: 300

consumer_strategy

No

String

Offset.

  • LATEST: maximum offset, indicating that the latest data will be extracted.

  • TRIM_HORIZON: minimum offset, indicating that the earliest data will be extracted.

Default: LATEST

Enumeration values:

  • LATEST

  • TRIM_HORIZON

dli_database_name

Yes

String

Name of the DLI database to which data in the DIS stream will be dumped

dli_table_name

Yes

String

Name of the DLI table to which data in the DIS stream will be dumped.

Note:

Only tables whose data location is DLI are supported, and you must have the permission to insert data into the tables.

obs_bucket_path

Yes

String

Name of the OBS bucket used to temporarily store data in the DIS stream

file_prefix

No

String

Self-defined directory created in the OBS bucket and used to temporarily store data in the DIS stream. Directory levels are separated by slashes (/) and cannot start with slashes.

The value can contain a maximum of 50 characters, including letters, digits, underscores (_), and slashes (/).

This parameter is left blank by default.

retry_duration

No

String

Time duration for DIS to retry if data fails to be dumped to DLI. If the retry time exceeds the value of this parameter, the data that fails to be dumped is backed up to the OBS bucket/file_prefix/dli_error directory.Value range: 0–7200Unit: secondDefault value: 1800If the value is set to 0, no retry is allowed.

Response Parameters

None

Example Requests

Adding DLI Dump Tasks

POST https://{Endpoint}/v2/{project_id}/streams/{stream_name}/transfer-tasks

{
  "destination_type" : "DLI",
  "dli_destination_descriptor" : {
    "task_name" : "dlitask",
    "consumer_strategy" : "LATEST",
    "agency_name" : "dis_admin_agency",
    "dli_database_name" : "dlidatabasename",
    "dli_table_name" : "dlitablename",
    "obs_bucket_path" : "obsbucket",
    "file_prefix" : "",
    "deliver_time_interval" : 300,
    "retry_duration " : 300
  }
}

Example Responses

None

Status Codes

Status Code

Description

201

Normal response

Error Codes

See Error Codes.