markap14 commented on code in PR #115:
URL: https://github.com/apache/nifi-api/pull/115#discussion_r4756484448
##########
src/main/java/org/apache/nifi/components/connector/components/ProcessGroupLifecycle.java:
##########
@@ -51,4 +51,20 @@ public interface ProcessGroupLifecycle {
CompletableFuture<Void> stopStatelessGroups(ComponentHierarchyScope scope);
int getActiveThreadCount();
+
+ /**
+ * Begins draining the Process Group, so that no new data is brought into
the group while the data already queued in it is processed.
+ * The drain stays active until {@link #endDrain()} is called.
+ *
+ * @return a future that completes once the drain has begun, or completes
exceptionally if the drain could not begin
+ */
+ default CompletableFuture<Void> beginDrain() {
+ throw new UnsupportedOperationException("Draining is not supported by
" + getClass().getName());
Review Comment:
I'm not sure that would give us a better outcome. It would avoid the
Exception but at the expense of returning a "lie." If we return a
`CompletableFuture` that is completed, we would be implying that the drain has
started, but in reality it has not. I think it makes more sense to throw an
Exception than to return a completed future for something that never happened.
Plus, this would only ever be an issue if we released a version of NiFi where
we include this change to the API without including the actual implementation
in the framework, which I don't expect to happen.
--
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]