yuxiqian commented on code in PR #4212:
URL: https://github.com/apache/flink-cdc/pull/4212#discussion_r2663283629


##########
flink-cdc-cli/src/main/java/org/apache/flink/cdc/cli/parser/YamlPipelineDefinitionParser.java:
##########
@@ -143,6 +149,13 @@ private PipelineDef parse(JsonNode pipelineDefJsonNode, 
Configuration globalPipe
                             ((ObjectNode) 
pipelineDefJsonNode.get(PIPELINE_KEY)).remove(MODEL_KEY))
                     .map(node -> validateArray("model", node))
                     .ifPresent(node -> modelDefs.addAll(parseModels(node)));
+
+            // Extract route-mode from pipeline if present
+            JsonNode pipelineNode = pipelineDefJsonNode.get(PIPELINE_KEY);
+            if (pipelineNode.has(ROUTE_MODE_KEY)) {
+                routeMode = pipelineNode.get(ROUTE_MODE_KEY).asText();
+                ((ObjectNode) pipelineNode).remove(ROUTE_MODE_KEY);
+            }

Review Comment:
   We may define `ROUTE_MODE_KEY` as an EnumOption in `PipelineOptions` and 
retrieve it later without modifying the parser:
   
   ```java
   RouteMode routeMode = pipelineConfig.get(PIPELINE_ROUTE_MODE_BEHAVIOR)
   ```
   
   similar to `PIPELINE_SCHEMA_CHANGE_BEHAVIOR`.



##########
flink-cdc-common/src/main/java/org/apache/flink/cdc/common/route/RouteRule.java:
##########
@@ -24,6 +24,43 @@ public class RouteRule implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    /** Match mode for routing rules. */
+    public enum MatchMode {

Review Comment:
   This enum should be part of public API. What about put it in 
`org.apache.flink.cdc.common.pipeline` and mark it with `@PublicEvolving`?



##########
flink-cdc-cli/src/main/java/org/apache/flink/cdc/cli/parser/YamlPipelineDefinitionParser.java:
##########
@@ -189,7 +202,14 @@ private PipelineDef parse(JsonNode pipelineDefJsonNode, 
Configuration globalPipe
         pipelineConfig.addAll(userPipelineConfig);
 
         return new PipelineDef(
-                sourceDef, sinkDef, routeDefs, transformDefs, udfDefs, 
modelDefs, pipelineConfig);
+                sourceDef,
+                sinkDef,
+                routeDefs,
+                routeMode,
+                transformDefs,
+                udfDefs,
+                modelDefs,
+                pipelineConfig);

Review Comment:
   Putting `routeMode` in `pipelineConfig` would be neater



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to