All Products
Search
Document Center

:GenerateDISyncTaskConfigForCreating

更新時間:May 06, 2024

Generates an ID for an asynchronous thread that is used to create a synchronization task in Data Integration. The ID is used when you call the QueryDISyncTaskConfigProcessResult operation to obtain parameters that are asynchronously generated and used to create a synchronization task in Data Integration.

DataWorks allows you to use the CreateDISyncTask operation to directly create a batch synchronization task in Data Integration. To create a real-time synchronization task or another type of synchronization task, you must first call the GenerateDISyncTaskConfigForCreating operation to generate the ID of an asynchronous thread and call the QueryDISyncTaskConfigProcessResult operation to obtain the asynchronously generated parameters based on the ID. Then, you can call the CreateDISyncTask operation and use the parameters as request parameters to create a real-time synchronization task or another type of synchronization task.

DataWorks allows you to create real-time synchronization tasks and other types of synchronization tasks in Data Integration only in asynchronous mode.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

GenerateDISyncTaskConfigForCreating

The operation that you want to perform.

ProjectId

Long

Yes

10000

The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the ID.

You must configure this parameter to specify the DataWorks workspace to which the API operation is applied.

TaskType

String

Yes

DI_REALTIME

The type of task that you want to create in Data Integration in asynchronous mode. Valid values:

  • DI_REALTIME: real-time synchronization task

  • DI_SOLUTION: another type of synchronization task

DataWorks allows you to create real-time synchronization tasks and other types of synchronization tasks in Data Integration only in asynchronous mode.

TaskParam

String

Yes

{ "type": "realtime", "version": "1.0", "setting": { "resourceGroup": "S_res_group_280749521950784_1623033752022", "taskType": "oneclick_to_odps" }, "steps": [{ "stepType": "mysql", "parameter": { "connection": [ { "datasourceType": "mysql", "datasource": "mysql_pub1", "selectedTables": [ { "dbName": "mysql_db", "schema": [ { "tableInfos": [ { "table": "molin_di_test_in_pk_v4" }] } ] } ] } ] }, "name": "Reader", "category": "reader" }, { "stepType": "odps", "parameter": { "datasource": "odps_source" }, "name": "Writer", "category": "writer" } ] }

The script for the synchronization task.

DataWorks allows you to create the following types of synchronization tasks:

  • Synchronization task that is used to synchronize data from MySQL to MaxCompute

  • Synchronization task that is used to synchronize data from MySQL data to Kafka

  • Synchronization task that is used to synchronize data from MySQL to Hologres

The SelectedTables parameter is used to specify tables that you want to synchronize from multiple databases. The Tables parameter is used to specify tables that you want to synchronize from a single database.

  • If the script contains the SelectedTables parameter, the system synchronizes data from the tables that you specify in the SelectedTables parameter.

  • If the script contains the Tables parameter, the system synchronizes data from the tables that you specify in the Tables parameter.

The following sample code provides a script for data synchronization from MySQL to MaxCompute:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_odps"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "mysql_pub1",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in_pk_v4"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "odps",
      "parameter": {
        "datasource": "odps_source"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

The following sample code provides a script for data synchronization from MySQL to Kafka:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_kafka"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "pkset_test",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in_pk_v4"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "kafka",
      "parameter": {
        "datasource": "azn_kafka"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

The following sample code provides a script for data synchronization from MySQL to Hologres:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_holo"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "mysql_pub",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in2_pk_v3"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "holo",
      "parameter": {
        "datasource": "holo"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

ClientToken

String

No

ABFUOEUOTRTRJKE

The client token that is used to ensure the idempotence of the request. This parameter is used to prevent repeated operations that are caused by multiple calls.

Response parameters

Parameter

Type

Example

Description

Success

Boolean

true

Indicates whether the request was successful. Valid values:

  • true

  • false

RequestId

String

0bc1411515937635973****

The request ID. You can locate logs and troubleshoot issues based on the ID.

Data

Object

The information returned for the ID of the asynchronous thread.

Status

String

true

Indicates whether the ID of the asynchronous thread is generated. Valid values:

  • success: indicates that the ID of the asynchronous thread is generated.

  • fail: indicates that the ID of the asynchronous thread fails to be generated. You can view the reason for the failure and troubleshoot the issue based on the reason.

ProcessId

Long

10

The ID of the asynchronous thread. You can call the QueryDISyncTaskConfigProcessResult operation to obtain the asynchronously generated parameters based on the ID. The parameters are used to create a synchronization task in Data Integration.

Message

String

XXX is invalid.

The reason why the ID of the asynchronous thread fails to be generated.

If the ID is successfully generated, no value is returned for this parameter.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GenerateDISyncTaskConfigForCreating
&ProjectId=10000
&TaskType=DI_REALTIME
&TaskParam={    "type": "realtime",     "version": "1.0",        "setting": {       "resourceGroup":       "S_res_group_280749521950784_1623033752022",        "scheduleResgroupId": 30003913,       "name": "openapi_realtime_solution_0813_1739",       "taskType": "oneclick_to_odps"     },     "steps": [         {             "stepType": "mysql",             "parameter": {                 "connection": [                     {                        "datasourceType": "mysql",                         "datasource": "mysql_pub",                         "table": [                             "xyx"                         ]                     }                 ]             },             "name": "Reader",             "category": "reader"         },         {             "stepType": "odps",             "parameter": {                 "datasource": "odps_source"             },             "name": "Writer",             "category": "writer"         }     ] }
&ClientToken=ABFUOEUOTRTRJKE
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GenerateDISyncTaskConfigForCreatingResponse>
    <Success>true</Success>
    <RequestId>0bc1411515937635973****</RequestId>
    <Data>
        <Status>true</Status>
        <ProcessId>10</ProcessId>
        <Message>XXX is invalid.</Message>
    </Data>
</GenerateDISyncTaskConfigForCreatingResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Success" : true,
  "RequestId" : "0bc1411515937635973****",
  "Data" : {
    "Status" : true,
    "ProcessId" : 10,
    "Message" : "XXX is invalid."
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400

Invalid.DI.Parameter

The parameter is invalid.

One or more parameters are invalid.

400

Invalid.DI.Parameter.File.Existed

The file name already exists.

The specified file name already exists.

403

Forbidden.DI.NoPrivilege

No access.

You do not have the required permissions.

500

InternalError.DI.Parameter

A DI internal error occurred.

An internal error has occurred in Data Integration.

For a list of error codes, see Service error codes.