创建转储任务
调用方法
请参见如何调用API。
URI
POST /v2/{project_id}/connectors/{connector_id}/sink-tasks
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
source_type |
是 |
String |
源数据类型,目前只支持BLOB。 |
|
task_name |
是 |
String |
转储任务名称。 |
|
destination_type |
是 |
String |
转存的目标类型,当前只支持OBS。 |
|
obs_destination_descriptor |
是 |
ObsDestinationDescriptor object |
转存目标的描述。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
topics |
是 |
String |
转存的topic列表名称,支持输入多个topic,以逗号“,”分隔。同时支持正则表达式。 |
|
topics_regex |
否 |
String |
转存topic的正则表达式,与topics必须二选一,不能同时都设置或者“.*”。 |
|
consumer_strategy |
是 |
String |
转储启动偏移量:
默认是latest。 |
|
destination_file_type |
是 |
String |
转储文件格式。当前只支持text。 |
|
access_key |
是 |
String |
访问密钥AK。 |
|
secret_key |
是 |
String |
访问密钥SK。 |
|
obs_bucket_name |
是 |
String |
存储该通道数据的OBS桶名称。 |
|
obs_path |
否 |
String |
存储在obs的路径,默认可以不填。 取值范围:英文字母、数字、下划线、中划线和斜杠,最大长度为64个字符。 默认配置为空。 |
|
partition_format |
是 |
String |
将转储文件的生成时间使用“yyyy/MM/dd/HH/mm”格式生成分区字符串,用来定义写到OBS的Object文件所在的目录层次结构。
说明:
数据转储成功后,存储的目录结构为“obs_bucket_path/file_prefix/partition_format”。默认时间是GMT+8 时间 |
|
record_delimiter |
否 |
String |
转储文件的记录分隔符,用于分隔写入转储文件的用户数据。 取值范围:
默认值:换行符“\n”。 |
|
deliver_time_interval |
是 |
Integer |
根据用户配置的时间,周期性的将数据导入OBS,若某个时间段内无数据,则此时间段不会生成打包文件。 取值范围:30~900 单位:秒。
说明:
使用OBS通道转储流式数据时该参数为必选配置。 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
task_id |
String |
任务ID。 |
请求示例
创建一个转储任务,转储topic-test中的数据到OBS。
POST https://{endpoint}/v2/{project_id}/connectors/{connector_id}/sink-tasks
{
"source_type" : "BLOB",
"task_name" : "obsTransfer-1122976956",
"destination_type" : "OBS",
"obs_destination_descriptor" : {
"consumer_strategy" : "earliest",
"destination_file_type" : "TEXT",
"access_key" : "XXXXXXXXXXXXXXXXXXXX",
"secret_key" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"obs_bucket_name" : "6666",
"obs_path" : "obsTransfer-1122976956",
"partition_format" : "yyyy/MM/dd/HH/mm",
"record_delimiter" : "",
"deliver_time_interval" : 300,
"topics" : "topic-test"
}
}
响应示例
状态码: 200
创建转储任务成功。
{
"task_id" : "2962882a-386c-4c9d-bb59-3b4f55d82961"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
创建转储任务成功。 |
错误码
请参见错误码。
