In C #
Is this a good idea? Any options?
Give the handle message (mailbox: actor & lt; 'a & gt;) msg = playful i = 1 match msg. Some x - & gt; I & lt; - i + x | None - & gt; ()
The way you have proposed it is perfectly appropriate The lack of concurrency to process only 1 message within the state at any time means that it is not possible to go to illegal states as a result of a dispute over shared memory space.
However, this is not the most idiotic choice. Akka.Net offers F # APIs to work with actors similar to the F # mailbox processor, in this case you will see the form of tail redemption function to your actor Which are said to themselves with some new states. Here is an example
Spawn system "Hello" & lt; | Fun Mailbox - & gt; REC Loop State = Enter Actor {Come on! Msg = Mailboxes Receive () printfn "received% A. now received% s message" msg raj returns! Loop (State + 1) // A message has been received by the actor for increasing the number of a counter} Loop 0
For complete documentation on Akka.Net F # API, see < / P>
No comments:
Post a Comment