CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams can be created on the DIS console.request.setStreamName(streamName);//Configure the dump task name.OBSDestinationDescriptorRequestdescriptor=newOBSDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure the OBS bucket name and folder name. You can create OBS buckets and files on the OBS console or client.descriptor.setObsBucketPath("obs-dis");descriptor.setFilePrefix("transfertask");//Configure the dump interval that is expressed in units of seconds.descriptor.setDeliverTimeInterval(900);//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//(Optional) Configure the dump file format. By default, the value is Text. Other available options are Parquet and CarbonData.descriptor.setDestinationFileType(DestinationFileTypeEnum.TEXT.getType());//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setObsDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.
CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams on the DIS console.request.setStreamName(streamName);//Configure the dump task name.MRSDestinationDescriptorRequestdescriptor=newMRSDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure the MRS cluster information about the cluster name and ID. You can create and query cluster information on the MRS console. The cluster must be in non-security mode.descriptor.setMrsClusterName("mrs_dis");descriptor.setMrsClusterId("fe69a732-c7d3-4b0f-8cda-ec9eca0cf141");//Configure the OBS bucket and folder that is used to temporarily store the data to be dumped to MRS and the dump failure data. You can create OBS buckets and folders on the OBS console.descriptor.setObsBucketPath("obs-dis");descriptor.setFilePrefix("transfertask");//Configure the dump interval that is expressed in units of seconds.descriptor.setDeliverTimeInterval(900);//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//(Optional) Configure the dump file format. By default, the value is Text. Other available options are Parquet and CarbonData.descriptor.setDestinationFileType(DestinationFileTypeEnum.TEXT.getType());//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setMrsDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.
CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams on the DIS console.request.setStreamName(streamName);//Configure the dump task name.UqueryDestinationDescriptorRequestdescriptor=newUqueryDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure DLI information about the database and internal table names. You can create and query DLI on the DLI console. The DLI table must be the internal table.descriptor.setDliDatabaseName("dis_dli");descriptor.setDliTableName("dis_test");//Configure the OBS bucket and folder that is used to temporarily store the data to be dumped to DLI and the dump failure data. You can create OBS buckets and folders on the OBS console or client.descriptor.setObsBucketPath("obs-dis");descriptor.setFilePrefix("transfertask");//Configure the dump interval that is expressed in units of seconds.descriptor.setDeliverTimeInterval(900);//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setDliDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.
CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams on the DIS console.request.setStreamName(streamName);//Configure the dump task name.DwsDestinationDescriptorRequestdescriptor=newDwsDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure the DWS cluster information about the cluster name, ID, and database. You can create and query clusters on the DWS console, and create tables using its client or other methods.descriptor.setDwsClusterName("dis_test");descriptor.setDwsClusterId("92f90f6a-de4d-4689-82f6-320c328b0062");descriptor.setDwsDatabaseName("postgres");descriptor.setDwsSchema("dbadmin");descriptor.setDwsTableName("distable01");descriptor.setDwsDelimiter("|");descriptor.setUserName("dbadmin");descriptor.setUserPassword("xxxx");//Call KMS to encrypt the DWS password to keep user data secure. You can create and query KMS on the KMS console.descriptor.setKmsUserKeyName("qiyinshan");descriptor.setKmsUserKeyId("9521c600-64a8-4971-ad36-7bbfa6d00c41");//Configure the OBS bucket and folder that is used to temporarily store the data to be dumped to DWS and the dump failure data. You can create OBS buckets and folders on the OBS console or client.descriptor.setObsBucketPath("obs-dis");descriptor.setFilePrefix("transfertask");//Configure the dump interval that is expressed in units of seconds.descriptor.setDeliverTimeInterval(900);//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setDwsDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.
CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams on the DIS console.request.setStreamName(streamName);//Configure the dump task name.CloudtableDestinationDescriptorRequestdescriptor=newCloudtableDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure the CloudTable cluster information about the cluster name, ID, and database. You can create and query clusters on the CloudTable console, and create tables using its client or other methods.descriptor.setCloudtableClusterName("dis_test");descriptor.setCloudtableClusterId("92f90f6a-de4d-4689-82f6-320c328b0062");descriptor.setCloudtableTableName("dis");//To configure CloudtableSchema, see CloudTable User Guide.CloudtableSchemacloudtableSchema=newCloudtableSchema();List<SchemaField>rowKeySchema=newArrayList<>();SchemaFieldfield1=newSchemaField();field1.setValue("id");field1.setType("String");rowKeySchema.add(field1);SchemaFieldrField1=newSchemaField();rField1.setValue("group.users.id");rField1.setType("String");rowKeySchema.add(rField1);List<SchemaField>columnsSchema=newArrayList<>();SchemaFieldfield2=newSchemaField();field2.setColumnFamilyName("user");field2.setQualifierName("id");field2.setValue("group.users.id");field2.setType("String");SchemaFieldfield3=newSchemaField();field3.setColumnFamilyName("user");field3.setQualifierName("age");field3.setValue("group.users.age");field3.setType("Int");columnsSchema.add(field2);columnsSchema.add(field3);cloudtableSchema.setRowKeySchema(rowKeySchema);cloudtableSchema.setColumnsSchema(columnsSchema);descriptor.setCloudtableSchema(cloudtableSchema);//Configure the OBS bucket and folder that is used to store dump failure data. You can create OBS buckets and folders on the OBS console or client.descriptor.setObsBackupBucketPath("obs-dis");descriptor.setBackupfilePrefix("transfertask");//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setCloudtableDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.
CreateTransferTaskRequestrequest=newCreateTransferTaskRequest();//Configure the stream name. You can create streams on the DIS console.request.setStreamName(streamName);//Configure the dump task name.CloudtableDestinationDescriptorRequestdescriptor=newCloudtableDestinationDescriptorRequest();descriptor.setTransferTaskName(taskName);//Configure the CloudTable OpenTSDB cluster information about the cluster name, ID, and database. You can create and query clusters on the CloudTable console, and create tables using its client or other methods.descriptor.setCloudtableClusterName("dlf_test");descriptor.setCloudtableClusterId("92f90f6a-de4d-4689-82f6-320c328b0062");//To configure OpenTSDBSchema, see CloudTable User Guide.List<SchemaField>metricSchema=newArrayList<>();SchemaFieldfield1=newSchemaField();field1.setValue("group.users.id");field1.setType("String");metricSchema.add(field1);SchemaFieldtimestampSchema=newSchemaField();timestampSchema.setColumnFamilyName("user");timestampSchema.setFormat("yyyy/MM/dd HH:mm:ss");timestampSchema.setValue("group.users.birthday");timestampSchema.setType("String");SchemaFieldvalueSchema=newSchemaField();valueSchema.setValue("group.users.age");valueSchema.setType("Int");List<SchemaField>tagsSchema=newArrayList<>();SchemaFieldfield2=newSchemaField();field2.setName("group.users.id");field2.setValue("group.users.id");field2.setType("String");SchemaFieldfield3=newSchemaField();field3.setName("age");field3.setValue("group.users.age");field3.setType("Int");tagsSchema.add(field2);tagsSchema.add(field3);OpenTSDBSchemaopenTSDBSchema=newOpenTSDBSchema();openTSDBSchema.setMetricSchema(metricSchema);openTSDBSchema.setTimestampSchema(timestampSchema);openTSDBSchema.setValueSchema(valueSchema);openTSDBSchema.setTagsSchema(tagsSchema);List<OpenTSDBSchema>openTSDBSchemaList=newArrayList<>();openTSDBSchemaList.add(openTSDBSchema);descriptor.setOpentsdbSchema(openTSDBSchemaList);//Configure the OBS bucket and folder that is used to store dump failure data. You can create OBS buckets and folders on the OBS console or client.descriptor.setObsBackupBucketPath("obs-dis");descriptor.setBackupfilePrefix("transfertask");//(Optional) Create an IAM agency named dis_admin_agency on the DIS management page and use it to access specific cloud services. For the first time to create an IAM agency, you have to authorize it.descriptor.setAgencyName("dis_admin_agency");//Configure the initial offset when data is pulled from the DIS stream. The value can be LATEST or TRIM_HORIZON. LATEST is the default value, indicating that data is read from the latest uploaded records in the stream. TRIM_HORIZON indicates that data is read from the earliest unexpired records in the stream.descriptor.setConsumerStrategy(PartitionCursorTypeEnum.LATEST.name());request.setCloudtableDestinationDescriptor(descriptor);
After configuring CreateTransferTaskRequest, you can call the createTransferTask method to create the dump task.