Skip to content

Commit

Permalink
(docs) Add note on prioritization of Ask() (#6959)
Browse files Browse the repository at this point in the history
* Add note on prioritization of Ask()

Per https://discordapp.com/channels/974500337396375553/974500337954222133/1160953337408135231

* Update receive-actor-api.md

Minor language tweak

* Change location of note

---------

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
  • Loading branch information
SeanKilleen and Arkatufus authored Oct 23, 2023
1 parent 35fc864 commit a34dd4a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/articles/actors/receive-actor-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ Task.WhenAll(tasks).PipeTo(actorC, Self);

This example demonstrates `Ask` together with the `Pipe` Pattern on tasks, because this is likely to be a common combination. Please note that all of the above is completely non-blocking and asynchronous: `Ask` produces a `Task`, two of which are awaited until both are completed, and when that happens, a new `Result` object is forwarded to another actor.

> [!NOTE]
> While `Ask` waits for a response, that does not ensure it receives any kind of priority. Messages sent via `Ask` queue in actor mailboxes the same way that messages sent via `Tell` do. You may need to adapt your actor hierarchy if `Ask` messages might be impeded by a large queue in an actor's mailbox.
Using `Ask` will send a message to the receiving Actor as with `Tell`, and the receiving actor must reply with `Sender.Tell(reply, Self)` in order to complete the returned `Task` with a value. The `Ask` operation involves creating an internal actor for handling this reply, which needs to have a timeout after which it is destroyed in order not to leak resources; see more below.

> [!WARNING]
Expand Down

0 comments on commit a34dd4a

Please sign in to comment.