guozhangwang commented on code in PR #12135:
URL: https://github.com/apache/kafka/pull/12135#discussion_r872593270


##########
streams/src/main/java/org/apache/kafka/streams/kstream/EmitStrategy.java:
##########
@@ -19,15 +19,52 @@
 import org.apache.kafka.streams.kstream.internals.UnlimitedWindow;
 import 
org.apache.kafka.streams.kstream.internals.emitstrategy.WindowCloseStrategy;
 import 
org.apache.kafka.streams.kstream.internals.emitstrategy.WindowUpdateStrategy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * This interface controls the strategy that can be used to control how we 
emit results in a processor.
  */
 public interface EmitStrategy {
 
+    Logger log = LoggerFactory.getLogger(EmitStrategy.class);
+
     enum StrategyType {
-        ON_WINDOW_CLOSE,
-        ON_WINDOW_UPDATE
+        ON_WINDOW_UPDATE(0, new WindowUpdateStrategy()),
+        ON_WINDOW_CLOSE(1, new WindowCloseStrategy());
+
+        private final short code;
+        private final EmitStrategy strategy;
+
+        private short code() {
+            return this.code;
+        }
+
+        private EmitStrategy strategy() {
+            return this.strategy;
+        }
+
+        StrategyType(final int code, final EmitStrategy strategy) {

Review Comment:
   This is because Java's default type is int -- i.e. line 36/37 above would 
take the value 0/1 as int. So we basically need to either do the conversion in 
each line of 36/37 above, or just do the conversion once here.
   
   I followed our other enums like `Errors` to do the conversion here.



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