pjfanning commented on code in PR #3024:
URL: https://github.com/apache/pekko/pull/3024#discussion_r3330792583
##########
stream/src/main/scala/org/apache/pekko/stream/Attributes.scala:
##########
@@ -629,6 +667,26 @@ object Attributes {
strategy: CancellationStrategy.Strategy): CancellationStrategy.Strategy =
CancellationStrategy.AfterDelay(delay, strategy)
+ /**
+ * Java API
+ *
+ * Strategy that ensures graceful shutdown for bidirectional components.
+ *
+ * When `cancelStage` is invoked, this strategy first completes all output
ports (regularly or with an error),
+ * then waits for a grace period to allow the completion/error signal to
propagate through the counterpart,
+ * and finally cancels all input ports.
+ *
+ * This addresses the race condition in bidirectional components where
cancelling the upstream side might
+ * prevent the error from being properly propagated downstream. By
completing outputs first and waiting,
+ * the error has a chance to bubble through the counterpart before the
upstream is cancelled.
+ *
+ * @param delay the grace period to wait after completing outputs before
cancelling inputs
+ */
Review Comment:
`@since 2.0.0`
--
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]