Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-22 Thread via GitHub


He-Pin merged PR #1819:
URL: https://github.com/apache/pekko/pull/1819


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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1668,6 +1669,25 @@ trait AsyncCallback[T] {
* to the invoking logic see [[AsyncCallback#invoke]]
*/
   def invokeWithFeedback(t: T): Future[Done]
+
+  /**
+   * Java API
+   *
+   * Dispatch an asynchronous notification. This method is thread-safe and
+   * may be invoked from external execution contexts.
+   *
+   * The method returns directly and the returned future is then completed 
once the event
+   * has been handled by the operator, if the event triggers an exception from 
the handler the future
+   * is failed with that exception and finally if the operator was stopped 
before the event has been
+   * handled the future is failed with `StreamDetachedException`.
+   *
+   * The handling of the returned future incurs a slight overhead, so for 
cases where it does not matter
+   * to the invoking logic see [[AsyncCallback#invoke]]
+   */

Review Comment:
   ```suggestion
  * @since 1.2.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: 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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   I will remove that tomorrow but I think this is and only should be called 
but never be implemented by user



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052747196


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Why not let users extend and even override this trait? I have no problem 
with the code changes - just the doc and annotation changes.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


mdedetrich commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052674972


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   So I am not seeing why this trait per se would be problematic to extend, it 
does seem generic enough users could plausibly want to provide their own 
implementation.
   
   The newly added method however does seem like it shouldn't be extended, in 
which case you would make it `final`.
   
   Or am I missing something?



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   I think the triat is for user calling, implemented by pekko , not for user 
extending



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


mdedetrich commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052660659


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   @He-Pin what is the reason for not making this user extensible, are you 
relying on some specific behaviour which could be redefined by a user of Pekko?



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052654133


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   The trait has been as is for a while. I am struggling to understand why this 
PR needs to change the docs and annotations about whether this trait is 
extensible.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


mdedetrich commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052649781


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Not sure if applicable but `@DoNotInherit` doesn't indicate that it can 
never be inherited, just that it shouldn't be inherited by users of Pekko 
library. The Pekko library itself can inherit it as much as it wants.
   
   The reason this annotation exists is because of limitations in Java, i.e. 
Java has no concept of sealed like Scala/Kotlin has



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


mdedetrich commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052649781


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Not sure if applicable but `@DoNotInherit` doesn't indicate that it can 
never be inherit, just that it shouldn't be inherited by users of Pekko. The 
Pekko library itself can inherit it as much as it wants.
   
   The reason this annotation exists is because of limitations in Java, i.e. 
Java has no concept of sealed like Scala/Kotlin has



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


mdedetrich commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052649781


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Not sure if applicable but ‘@DoNotInherit` doesn't indicate that it can 
never be inherit, just that it shouldn't be inherited by users of Pekko. The 
Pekko library itself can inherit it as much as it wants.
   
   The reason this annotation exists is because of limitations in Java, i.e. 
Java has no concept of sealed like Scala/Kotlin has



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052410840


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1668,6 +1672,25 @@ trait AsyncCallback[T] {
* to the invoking logic see [[AsyncCallback#invoke]]
*/
   def invokeWithFeedback(t: T): Future[Done]
+
+  /**
+   * Java API
+   *
+   * Dispatch an asynchronous notification. This method is thread-safe and
+   * may be invoked from external execution contexts.
+   *
+   * The method returns directly and the returned future is then completed 
once the event
+   * has been handled by the operator, if the event triggers an exception from 
the handler the future
+   * is failed with that exception and finally if the operator was stopped 
before the event has been
+   * handled the future is failed with `StreamDetachedException`.
+   *
+   * The handling of the returned future incurs a slight overhead, so for 
cases where it does not matter
+   * to the invoking logic see [[AsyncCallback#invoke]]
+   */
+  def invokeWithFeedbackCompletionStage(t: T): CompletionStage[Done] = {

Review Comment:
   `@since 1.2.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: 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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052408927


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Can we just undo the new comment and annotation then?



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1668,6 +1672,25 @@ trait AsyncCallback[T] {
* to the invoking logic see [[AsyncCallback#invoke]]
*/
   def invokeWithFeedback(t: T): Future[Done]
+
+  /**
+   * Java API
+   *
+   * Dispatch an asynchronous notification. This method is thread-safe and
+   * may be invoked from external execution contexts.
+   *
+   * The method returns directly and the returned future is then completed 
once the event
+   * has been handled by the operator, if the event triggers an exception from 
the handler the future
+   * is failed with that exception and finally if the operator was stopped 
before the event has been
+   * handled the future is failed with `StreamDetachedException`.
+   *
+   * The handling of the returned future incurs a slight overhead, so for 
cases where it does not matter
+   * to the invoking logic see [[AsyncCallback#invoke]]
+   */
+  def invokeWithFeedbackCompletionStage(t: T): CompletionStage[Done] = {
+import pekko.util.FutureConverters._
+invokeWithFeedback(t).asJava
+  }

Review Comment:
   test added



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   The `AsyncCallback` is been called by user's code, so internal usage may not 
right.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Do you mean add an @InternalApi annotation.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   Do you mean add an @InternalApi annotation.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052339930


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1668,6 +1672,25 @@ trait AsyncCallback[T] {
* to the invoking logic see [[AsyncCallback#invoke]]
*/
   def invokeWithFeedback(t: T): Future[Done]
+
+  /**
+   * Java API
+   *
+   * Dispatch an asynchronous notification. This method is thread-safe and
+   * may be invoked from external execution contexts.
+   *
+   * The method returns directly and the returned future is then completed 
once the event
+   * has been handled by the operator, if the event triggers an exception from 
the handler the future
+   * is failed with that exception and finally if the operator was stopped 
before the event has been
+   * handled the future is failed with `StreamDetachedException`.
+   *
+   * The handling of the returned future incurs a slight overhead, so for 
cases where it does not matter
+   * to the invoking logic see [[AsyncCallback#invoke]]
+   */
+  def invokeWithFeedbackCompletionStage(t: T): CompletionStage[Done] = {
+import pekko.util.FutureConverters._
+invokeWithFeedback(t).asJava
+  }

Review Comment:
   is it possible to add a basic unit test?



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052339713


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   That's my point. It can be inherited. Can we remove this annotation and 
maybe change the to say that this is for Pekko Internal Usage? 



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


pjfanning commented on code in PR #1819:
URL: https://github.com/apache/pekko/pull/1819#discussion_r2052302443


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   I don't understand this. `def invokeWithFeedback(t: T): Future[Done]` is not 
implemented so this trait needs to be extended.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-21 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1643,7 +1644,10 @@ abstract class GraphStageLogic private[stream] (val 
inCount: Int, val outCount:
  *
  * Typical use cases are exchanging messages between stream and substreams or 
invoking from external world sending
  * event to a stream
+ *
+ * Not for user extension
  */
+@DoNotInherit

Review Comment:
   It's already been implemented by the `ConcurrentAsyncCallback` in GraphStage.



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



Re: [PR] feat: Add invokeWithFeedbackCompletionStage for javadsl. [pekko]

2025-04-19 Thread via GitHub


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


##
stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala:
##
@@ -1668,6 +1672,25 @@ trait AsyncCallback[T] {
* to the invoking logic see [[AsyncCallback#invoke]]
*/
   def invokeWithFeedback(t: T): Future[Done]
+
+  /**
+   * Java API
+   *
+   * Dispatch an asynchronous notification. This method is thread-safe and
+   * may be invoked from external execution contexts.
+   *
+   * The method returns directly and the returned future is then completed 
once the event
+   * has been handled by the operator, if the event triggers an exception from 
the handler the future
+   * is failed with that exception and finally if the operator was stopped 
before the event has been
+   * handled the future is failed with `StreamDetachedException`.
+   *
+   * The handling of the returned future incurs a slight overhead, so for 
cases where it does not matter
+   * to the invoking logic see [[AsyncCallback#invoke]]
+   */
+  def invokeWithFeedbackCompletionStage(t: T): CompletionStage[Done] = {
+import pekko.util.FutureConverters._
+invokeWithFeedback(t).asJava
+  }

Review Comment:
   It would be nice if we could split this method into something else, but as 
the graphdsl is not separated with two `javadsl/scaladsl` , I have to add it 
here.
   cons: 
   1. scala developer will see this
   2. name is too long.
   
   



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