How to use pipeTo in AKKA correctly

我怕爱的太早我们不能终老 提交于 2020-01-14 04:55:10

问题


Hi I have two examples below within the receive method of an actor:

First one does not cache the sender actor for piping

val futureV = //Some function call that returns a Future
futureV.pipeTo(sender)

Second one takes the sender in a val first

val currentS=sender
val futureV = //Some function call that returns a Future
futureV.pipeTo(currentS)

My question is which one is the correct way to code and why?


回答1:


They are the same. The sender is not going to change. pipeTo takes its argument by value, not by name.



来源:https://stackoverflow.com/questions/33858051/how-to-use-pipeto-in-akka-correctly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!