Subscription Object Configuration

Updated at:

When you call the ConfigureSubscriptionInstance operation, you must pass a subscription object as a parameter. This topic describes the subscription object and provides configuration examples.

Related APIs

Configure a subscription instance

Definition of the SubscriptionObjects parameter

The SubscriptionObjects parameter specifies the subscription objects. The value is an array of JSON objects and supports regular expressions. The following code shows the definition of the parameter.

[{
    "DBName": "The name of the database from which you want to track data changes",
    "TableIncludes": [{
        "TableName": "The name of the table from which you want to track data changes"
    }],
    "TableExluces": [{
        "TableName": "The name of the table that you want to exclude from the change tracking task"
    }]
}]

Configuration examples

Example 1: Subscribe to all tables in the dtstestdata database.

[{
    "DBName": "dtstestdata"
}]

Example 2: Track data changes from all tables in the dtstestdata and mysqltest databases.

[{
    "DBName": "dtstestdata"
},{
    "DBName": "mysqltest"
}]

Example 3: This example shows how to subscribe to the customer and order tables in the dtstestdata database.

[{
    "DBName": "dtstestdata",
    "TableIncludes": [{
        "TableName": "customer"
    }, {
        "TableName": "order"
    }]
}]

Example 4: Track data changes from all tables in the dtstestdata database except the tables whose names are prefixed with "order."

[{
    "DBName": "dtstestdata",
    "TableExcludes": [{
        "TableName": "order.*"
    }]
}]

Supported regular expressions

Symbol

Rule description

Period (.)

Matches any single character except for '\r\n'.

Asterisk (*)

Matches the preceding subexpression zero or more times. For example, h.*llo matches strings such as hllo and heeeello.

Question mark (?)

Matches the preceding subexpression zero or one time. For example, h.?llo matches hllo and hello, but not haello.

[characters] Character set

Matches any single character in the brackets. For example, h[ae]llo matches hallo and hello.

[^characters] Negative character set

Matches any single character not in the brackets. For example, h[^ae]llo matches hcllo or hdllo, but not hallo or hello.

[character1-character2] Character range

Matches any character within the range from character1 to character2. For example, [0-9] and [a-z].