alnzng commented on code in PR #103:
URL: https://github.com/apache/flink-agents/pull/103#discussion_r2267693823


##########
runtime/src/main/java/org/apache/flink/agents/runtime/operator/ActionExecutionOperator.java:
##########
@@ -176,13 +184,26 @@ public void open() throws Exception {
 
         mailboxProcessor = getMailboxProcessor();
 
+        // Initialize the event logger if it is set.
+        initEventLogger();
+
         // Since an operator restart may change the key range it manages due 
to changes in
         // parallelism,
         // and {@link tryProcessActionTaskForKey} mails might be lost,
         // it is necessary to reprocess all keys to ensure correctness.
         tryResumeProcessActionTasks();
     }
 
+    private void initEventLogger() throws Exception {
+        if (eventLogger == null) {
+            return;
+        }
+        if (eventLogger.unwrap() instanceof FlinkStateEventLogger) {
+            ((FlinkStateEventLogger) 
eventLogger).setStreamingRuntimeContext(getRuntimeContext());
+        }

Review Comment:
   Yes, this `unwrap` is used only for `FlinkStateEventLogger` at this moment. 
Since we are going to remove this `FlinkStateEventLogger`, this `unwrap` is not 
that useful so that I can remove it.
   
   >IIUC, the reason we need EventFilter.ACCEPT_ALL is also that we need to 
make sure here the eventLogger is a wrapped one?
   
   No. Having `EventFilter.ACCEPT_ALL` is just for allowing EventFilter as an 
optional while enablign the EventLogger. 
   
   ```java
   public AgentsExecutionEnvironment enableEventLogger(EventLogger eventLogger) 
{
           return enableEventLogger(eventLogger, EventFilter.ACCEPT_ALL);
       }
   ```
   
   The wappered EventLogger is for enabling the filter function by default, it 
is a decorator pattern for EventLogger.
   
   ``` java
   public void append(EventContext context, Event event) throws Exception {
                   if (filter.accept(event, context)) {
                       delegate.append(context, event);
                   }
               }
   ```



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