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


##########
persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/Effect.scala:
##########
@@ -195,6 +195,13 @@ trait EffectBuilder[+Event, State] extends Effect[Event, 
State] {
  */
 @DoNotInherit trait ReplyEffect[+Event, State] extends Effect[Event, State] {
 
+  /**
+   * Stop the actor after executing the preceding side effects.
+   *
+   * @since 2.0.0
+   */
+  def thenStop(): ReplyEffect[Event, State]

Review Comment:
   Declaring `thenStop()` on `ReplyEffect` also makes 
`Effect.stash().thenStop()` compile, because `stash()` returns `ReplyEffect`. 
The javadsl `Effect().stash().thenStop()` and the durable-state DSLs are 
affected the same way. Before this change that combination was a compile error.
   
   At runtime it stashes the current command and then stops the actor, so the 
stashed command is dropped or dead-lettered without a reply, even with enforced 
replies. A refactor that appends `.thenStop()` to a branch that happens to 
stash would hit this silently.
   
   Could we either rule this out (for example, keep `stash()` returning a type 
that doesn't expose `thenStop`) or at least document in the Scaladoc/Javadoc 
that `stash().thenStop()` discards the stashed command?
   



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

Reply via email to