raboof commented on code in PR #2250:
URL: https://github.com/apache/pekko/pull/2250#discussion_r2368376790
##########
stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala:
##########
@@ -312,6 +312,19 @@ object Sink {
if (fanout) new
FanoutPublisherSink[T](DefaultAttributes.fanoutPublisherSink,
shape("FanoutPublisherSink"))
else new PublisherSink[T](DefaultAttributes.publisherSink,
shape("PublisherSink")))
+ /**
+ * A `Sink` that materializes this `Sink` itself as a `Source`.
+ * The returned `Source` is a "live view" onto the `Sink` and only supports
a single `Subscriber`.
Review Comment:
Do I understand correctly that this means if you materialize a stream with
this sink, you'll get a `Source` as a materialized value, but this `Source`
will be 'special' in that it can only be materialized once?
While I agree having 'object creation' and 'materialization' as separate
phases sometimes makes it challenging to design good API's, I'm concerned that
adding APIs that violate these concepts will make things harder and more
confusing, instead of simpler.
Before adding such methods I think we should identify a real-world example
which such a sink would be valuable, and there's no better way to achieve the
desired behavior?
##########
docs/src/main/paradox/stream/operators/Sink/source.md:
##########
@@ -0,0 +1,27 @@
+# Sink.source
+
+Always backpressure never cancel and never consume any elements from the
stream.
Review Comment:
This doesn't seem accurate, and doesn't seem like an accurate description of
what this sink does.
From the javadoc, "A `Sink` that materializes this `Sink` itself as a
`Source`." seems like a better description?
--
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]