JinkunLiu commented on code in PR #950:
URL: https://github.com/apache/flink-agents/pull/950#discussion_r3743372184
##########
api/src/main/java/org/apache/flink/agents/api/Event.java:
##########
@@ -46,25 +48,34 @@ public class Event {
/** Unified event with user-defined type and attributes. */
public Event(String type, Map<String, Object> attributes) {
- this(UUID.randomUUID(), type, attributes);
+ this(UUID.randomUUID(), type, attributes, new HashMap<>());
}
/** Unified event with user-defined type and empty attributes. */
public Event(String type) {
this(type, new HashMap<>());
}
- @JsonCreator
public Event(
@JsonProperty("id") UUID id,
@JsonProperty("type") String type,
@JsonProperty("attributes") Map<String, Object> attributes) {
+ this(id, type, attributes, new HashMap<>());
+ }
+
+ @JsonCreator
+ public Event(
+ @JsonProperty("id") UUID id,
+ @JsonProperty("type") String type,
+ @JsonProperty("attributes") Map<String, Object> attributes,
+ @JsonProperty("attachments") Map<String, Object> attachments) {
if (type == null || type.isEmpty()) {
throw new IllegalArgumentException("Event 'type' must not be null
or empty.");
}
this.id = id;
this.type = type;
this.attributes = attributes != null ? attributes : new HashMap<>();
+ this.attachments = attachments != null ? attachments : new HashMap<>();
Review Comment:
Fix it in both attachments and attributes.
[e2aa09e0](https://github.com/apache/flink-agents/pull/950/changes/e2aa09e04c7b199e326c97b7d844f2b6b8a0d7e3)
--
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]