Class TableIdRouter
- java.lang.Object
-
- org.apache.flink.cdc.common.route.TableIdRouter
-
@PublicEvolving public class TableIdRouter extends Object
Calculates how upstream data change events should be dispatched to downstream tables. Returns one or many destination Table IDs based on provided routing rules.
-
-
Constructor Summary
Constructors Constructor Description TableIdRouter(List<RouteRule> routingRules)TableIdRouter(List<RouteRule> routingRules, RouteMode routeMode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringconvertTableListToRegExpPattern(String tables)Currently, The supported regular syntax is not exactly the same inSelectors.List<Set<TableId>>groupSourceTablesByRouteRule(Set<TableId> tableIdSet)Group the source tables that conform to the same routing rule together.List<TableId>route(TableId sourceTableId)
-
-
-
Method Detail
-
convertTableListToRegExpPattern
public static String convertTableListToRegExpPattern(String tables)
Currently, The supported regular syntax is not exactly the same inSelectors.The main discrepancies are :
1)
Selectorsuse,to split table names instead of `|`.2) If there is a need to use a dot (
.) in a regular expression to match any character, it is necessary to escape the dot with a backslash.3) The unescaped
.is used as the separator of database and table name. When converting to Debezium style, it is expected to be escaped to match the dot (.) literally instead of the meta-character.
-
groupSourceTablesByRouteRule
public List<Set<TableId>> groupSourceTablesByRouteRule(Set<TableId> tableIdSet)
Group the source tables that conform to the same routing rule together. The total number of groups is less than or equal to the number of routing rules. For the source tables within each group, their table structures will be merged to obtain the widest table structure in that group. The structures of all tables within the group will be expanded to this widest table structure.- Parameters:
tableIdSet- The tables need to be grouped by the router- Returns:
- The tables grouped by the router
-
-