MailboxProcessor<'Msg> Type
A message-processing agent which executes an asynchronous computation.
The agent encapsulates a message queue that supports multiple-writers and a single reader agent. Writers send messages to the agent by using the Post method and its variations. The agent may wait for messages using the Receive or TryReceive methods or scan through all available messages using the Scan or TryScan method.
Constructors
Constructor | Description |
Full Usage:
MailboxProcessor(body, isThrowExceptionAfterDisposed, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when Start is called.
isThrowExceptionAfterDisposed : bool
-
A flag denoting that an exception will be thrown
when MailboxProcessor.Post is called
after Control.MailboxProcessor has been disposed.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|
Full Usage:
MailboxProcessor(body, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when Start is called.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|
Instance members
Instance member | Description | ||
|
|
||
Full Usage:
this.DefaultTimeout
|
|||
Full Usage:
this.Dispose
|
|||
|
|||
Full Usage:
this.Post
Parameters:
'Msg
-
The message to post.
|
|||
Full Usage:
this.PostAndAsyncReply
Parameters:
AsyncReplyChannel<'Reply> -> 'Msg
-
The function to incorporate the AsyncReplyChannel into
the message to be sent.
?timeout : int
-
An optional timeout parameter (in milliseconds) to wait for a reply message.
Defaults to -1 which corresponds to Timeout.Infinite.
Returns: Async<'Reply>
An asynchronous computation that will wait for the reply from the agent.
|
The message is generated by applying
|
||
Full Usage:
this.PostAndReply
Parameters:
AsyncReplyChannel<'Reply> -> 'Msg
-
The function to incorporate the AsyncReplyChannel into
the message to be sent.
?timeout : int
-
An optional timeout parameter (in milliseconds) to wait for a reply message.
Defaults to -1 which corresponds to Timeout.Infinite.
Returns: 'Reply
The reply from the agent.
|
The message is generated by applying
|
||
Full Usage:
this.PostAndTryAsyncReply
Parameters:
AsyncReplyChannel<'Reply> -> 'Msg
-
The function to incorporate the AsyncReplyChannel into
the message to be sent.
?timeout : int
-
An optional timeout parameter (in milliseconds) to wait for a reply message.
Defaults to -1 which corresponds to Timeout.Infinite.
Returns: Async<'Reply option>
An asynchronous computation that will return the reply or None if the timeout expires.
|
|
||
Full Usage:
this.Receive
Parameters:
int
-
An optional timeout in milliseconds. Defaults to -1 which corresponds
to Timeout.Infinite.
Returns: Async<'Msg>
An asynchronous computation that returns the received message.
|
This method is for use within the body of the agent. This method is for use within the body of the agent. For each agent, at most one concurrent reader may be active, so no more than one concurrent call to Receive, TryReceive, Scan and/or TryScan may be active.
|
||
Full Usage:
this.Scan
Parameters:
'Msg -> Async<'T> option
-
The function to return None if the message is to be skipped
or Some if the message is to be processed and removed from the queue.
?timeout : int
-
An optional timeout in milliseconds. Defaults to -1 which corresponds
to Timeout.Infinite.
Returns: Async<'T>
An asynchronous computation that scanner built off the read message.
|
Returns None if a timeout is given and the timeout is exceeded. This method is for use within the body of the agent. For each agent, at most one concurrent reader may be active, so no more than one concurrent call to Receive, TryReceive, Scan and/or TryScan may be active.
|
||
Full Usage:
this.Start
|
|||
Full Usage:
this.StartImmediate
|
|||
Full Usage:
this.TryPostAndReply
Parameters:
AsyncReplyChannel<'Reply> -> 'Msg
-
The function to incorporate the AsyncReplyChannel into
the message to be sent.
?timeout : int
-
An optional timeout parameter (in milliseconds) to wait for a reply message.
Defaults to -1 which corresponds to Timeout.Infinite.
Returns: 'Reply option
The reply from the agent or None if the timeout expires.
|
|
||
Full Usage:
this.TryReceive
Parameters:
int
-
An optional timeout in milliseconds. Defaults to -1 which
corresponds to Timeout.Infinite.
Returns: Async<'Msg option>
An asynchronous computation that returns the received message or
None if the timeout is exceeded.
|
This method is for use within the body of the agent. Returns None if a timeout is given and the timeout is exceeded. This method is for use within the body of the agent. For each agent, at most one concurrent reader may be active, so no more than one concurrent call to Receive, TryReceive, Scan and/or TryScan may be active.
|
||
Full Usage:
this.TryScan
Parameters:
'Msg -> Async<'T> option
-
The function to return None if the message is to be skipped
or Some if the message is to be processed and removed from the queue.
?timeout : int
-
An optional timeout in milliseconds. Defaults to -1 which corresponds
to Timeout.Infinite.
Returns: Async<'T option>
An asynchronous computation that scanner built off the read message.
|
This method is for use within the body of the agent. For each agent, at most one concurrent reader may be active, so no more than one concurrent call to Receive, TryReceive, Scan and/or TryScan may be active.
|
Static members
Static member | Description |
Full Usage:
MailboxProcessor.Start(body, isThrowExceptionAfterDisposed, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when Start is called.
isThrowExceptionAfterDisposed : bool
-
A flag denoting that an exception will be thrown
when MailboxProcessor.Post is called
after Control.MailboxProcessor has been disposed.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|
Full Usage:
MailboxProcessor.Start(body, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when Start is called.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|
Full Usage:
MailboxProcessor.StartImmediate(body, isThrowExceptionAfterDisposed, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when StartImmediately is called.
isThrowExceptionAfterDisposed : bool
-
A flag denotes will be thrown exception
when MailboxProcessor.Post is called
after Control.MailboxProcessor disposed.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|
Full Usage:
MailboxProcessor.StartImmediate(body, ?cancellationToken)
Parameters:
MailboxProcessor<'Msg> -> Async<unit>
-
The function to produce an asynchronous computation that will be executed
as the read loop for the MailboxProcessor when StartImmediately is called.
?cancellationToken : CancellationToken
-
An optional cancellation token for the body .
Defaults to Async.DefaultCancellationToken .
Returns: MailboxProcessor<'Msg>
The created MailboxProcessor.
|
|