I've seen different snippets demonstrating a Put
message that returns unit
with F#'s MailboxProcessor
. In some, only the Post
method is used while others use PostAndAsyncReply
, with the reply channel immediately replying once the message is being processed. In doing some testing, I found a significant time lag when awaiting the reply, so it seems that unless you need a real reply, you should use Post
.
Note: I started asking this in another thread but thought it useful to post as a full question. In the other thread, Tomas Petricek mentioned that the reply channel could be used a wait mechanism to ensure the caller delayed until the Put
message was processed.
Does using PostAndAsyncReply
help with message ordering, or is it just to force a pause until the first message is processed? In terms of performance Post
appears the right solution. Is that accurate?
Update:
I just thought of a reason why PostAndAsyncReply
might be necessary in the BlockingQueueAgent
example: Scan
is used to find Get
messages when the queue is full, so you don't want to Put
and then Get
before the previous Put
has completed.