Akka in Scala, exclamation mark and question mark

后端 未结 2 1750
故里飘歌
故里飘歌 2021-01-30 06:36

What is the difference between exclamation mark (!) and question mark (?) when sending messages to Actors?

myActor ! Hello(value1)
myAc         


        
2条回答
  •  渐次进展
    2021-01-30 07:02

    Shamelessly copied [awesome] official doc (look Send messages section for more):

    Messages are sent to an Actor through one of the following methods.

    ! means “fire-and-forget”, e.g. send a message asynchronously and return immediately. Also known as tell.

    ? sends a message asynchronously and returns a Future representing a possible reply. Also known as ask.

提交回复
热议问题