kirktrue commented on code in PR #15438:
URL: https://github.com/apache/kafka/pull/15438#discussion_r1506928334


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEvent.java:
##########
@@ -32,36 +36,42 @@ public enum Type {
 
     private final Type type;
 
+    /**
+     * This identifies a particular event. It is used to disambiguate events 
via {@link #hashCode()} and
+     * {@link #equals(Object)} and can be used in log messages when debugging.
+     */
+    private final Uuid id;
+
     protected ApplicationEvent(Type type) {
         this.type = Objects.requireNonNull(type);
+        this.id = Uuid.randomUuid();
     }
 
     public Type type() {
         return type;
     }
 
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        ApplicationEvent that = (ApplicationEvent) o;
+    public Uuid id() {
+        return id;
+    }
 
-        return type == that.type;
+    @Override
+    public final boolean equals(Object o) {

Review Comment:
   Until now, `equals()` and `hashCode()` were only used in unit tests to make 
sure that the event that was enqueued was the same one that was processed. (We 
had weird bugs in the past where that wasn't always true.)
   
   I can imagine cases where we would want to determine event _similarity_ vs. 
just event _identity_, but I don't think we have any of those at this point 🤔 



-- 
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