jmckenzie-dev commented on code in PR #178:
URL: 
https://github.com/apache/cassandra-analytics/pull/178#discussion_r2942070240


##########
cassandra-analytics-cdc/src/main/java/org/apache/cassandra/cdc/api/EventConsumer.java:
##########
@@ -25,4 +25,17 @@
 
 public interface EventConsumer extends Consumer<CdcEvent>
 {
+    /**
+     * Flush any pending events to the transport layer.
+     * Called after each micro-batch and before CDC state is persisted, to 
ensure
+     * all events have been durably delivered before the commit-log position 
advances.
+     * If delivery fails, implementations must throw so that state is NOT 
persisted
+     * and the micro-batch will be retried on the next run.
+     *
+     * @throws InterruptedException if the calling thread is interrupted while 
flushing
+     */
+    default void flush() throws InterruptedException

Review Comment:
   Promoting `flush()` to the interface level implies that all `EventConsumer` 
objects will have some kind of a) need to flush, and b) a transport layer they 
are coupled with (as per the javadoc here). If we want to go this route, I'd 
recommend we change the name from `EventConsumer` to `PersistingEventConsumer` 
to make the interface name match the forced promotion of `flush` to being part 
of its API.
   
   Given the default implementation is a noop, this actually feels like a 
suboptimal design; we're promoting `flush` to the interface level so we have 
access to it from someone calling the interface but the lack of default 
implementation and this method not being abstract (i.e. forcing an 
implementation from all implementers of the class) is leaking an internal 
detail of one implementation of the class.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to