He-Pin commented on code in PR #1422:
URL: https://github.com/apache/pekko/pull/1422#discussion_r1703583269


##########
stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala:
##########
@@ -428,6 +428,57 @@ object Flow {
    */
   def fromFunction[A, B](f: A => B): Flow[A, B, NotUsed] = apply[A].map(f)
 
+  /**
+   * Creates a FlowW from an existing base Flow outputting an optional element 
and
+   * applying an additional viaFlow only if the element in the stream is 
defined.
+   *
+   * '''Emits when''' the provided viaFlow is runs with defined elements
+   *
+   * '''Backpressures when''' the viaFlow runs for the defined elements and 
downstream backpressures
+   *
+   * '''Completes when''' upstream completes
+   *
+   * '''Cancels when''' downstream cancels
+   *
+   * @param flow The base flow that outputs an optional element
+   * @param viaFlow The flow that gets used if the optional element in is 
defined.
+   * @param combine How to combine the materialized values of flow and viaFlow
+   * @return a Flow with the viaFlow applied onto defined elements of the 
flow. The output value
+   *         is contained within an Option which indicates whether the 
original flow's element had viaFlow
+   *         applied.
+   * @since 1.1.0
+   */
+  def optionalVia[FIn, FOut, FViaOut, FMat, FViaMat, Mat](flow: Flow[FIn, 
Option[FOut], FMat],

Review Comment:
   The optional is just a kind of marker field, you can have an object with a 
field `additionalProcessEnabled:Boolean` for that case.
   
   I suggest we look at fs2/zio/reactor-core for the same case before we merge 
this.



-- 
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: notifications-unsubscr...@pekko.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to