MailboxProcessor or Akka.NET

Wondering the difference between use cases as in when/where it would be more sensible to utilise one over the other …

The short answer is that Akka determines the architecture of your entire service/system, whereas the MailboxProcessor is a workhorse you can utilise for background processing (it is much simpler).
Both are very specialised though, so unless you have very special needs I believe you can use simpler/safer methods still. Akka is too complex and a whole other way of building services, and MailboxProcessor is too simple to be used safely (it doesn’t recover from crashes, leaving that up to you). If you need background processing, you’d be better off looking into a queuing system such as Azure ServiceBus or RabbitMq (or MSMQ if you’re still on Windows - it is simple and very useful). These are just my opinions though, someone else might have entirely different preferences :slightly_smiling_face:

I recently built a WebSocket server and client using MailboxProcessors for tracking active connections, potential connections (on the client side) as well as messages coming in off the protocol and for messages to be sent out over the protocol. I remember looking at Akka.Net way early in the planning stage, but I wanted something that was explicitly functional in paradigm.
So I can’t help you compare one to the other, but personally I’m far more partial to using ‘first party’ native stuff over 3rd party libraries. Especially when, in F#'s case, first party also means idiomatic and easy to integrate.

1 Like