wenjin272 commented on code in PR #756:
URL: https://github.com/apache/flink-agents/pull/756#discussion_r3496805996
##########
plan/src/test/resources/actions/action_java_function.json:
##########
@@ -6,5 +6,5 @@
"method_name": "legal",
"parameter_types": ["org.apache.flink.agents.api.Event",
"org.apache.flink.agents.api.context.RunnerContext"]
},
- "listen_event_types": ["_input_event"]
+ "trigger_conditions": ["_input_event"]
Review Comment:
The field name in `action_invalid_event_type.json`,
`action_missing_fields.json` and `action_invalid_function_type.json` were not
adapted.
##########
plan/src/main/java/org/apache/flink/agents/plan/serializer/ActionJsonDeserializer.java:
##########
@@ -66,10 +66,12 @@ public Action deserialize(JsonParser jsonParser,
DeserializationContext deserial
throw new IOException("Unsupported function type: " + funcType);
}
- // Deserialize listenEventTypes
- List<String> listenEventTypes = new ArrayList<>();
- node.get("listen_event_types")
- .forEach(eventTypeNode ->
listenEventTypes.add(eventTypeNode.asText()));
+ // Deserialize trigger_conditions
+ List<String> triggerConditions = new ArrayList<>();
+ JsonNode triggerNode = node.get("trigger_conditions");
+ if (triggerNode != null) {
Review Comment:
The `trigger_conditions` should not be null.
##########
plan/src/main/java/org/apache/flink/agents/plan/AgentPlan.java:
##########
@@ -184,27 +184,27 @@ private void readObject(ObjectInputStream in) throws
IOException, ClassNotFoundE
private void extractActions(
String actionName,
- String[] listenEventTypeStrings,
+ String[] triggerEntries,
org.apache.flink.agents.plan.Function function,
Map<String, Object> config)
throws Exception {
- List<String> eventTypeNames = new
ArrayList<>(Arrays.asList(listenEventTypeStrings));
+ List<String> triggerConditions = new
ArrayList<>(Arrays.asList(triggerEntries));
- if (eventTypeNames.isEmpty()) {
+ if (triggerConditions.isEmpty()) {
throw new IllegalArgumentException(
"Action "
+ actionName
- + " must specify at least one event type via
listenEventTypes.");
+ + " must specify at least one trigger entry via
@Action(value = ...).");
Review Comment:
Consider using `@Action(EventType.x)` in the error message.
--
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]