How to get started with Akka.Net


Akka.Net is an open source, distributed computing framework built by Petabridge. Akka.Net allows you to create scalable, resilient, concurrent, event-driven applications using the actor model. In this article I will introduce the important concepts behind Akka.Net, discuss why it is useful, and help you get started working with Akka.Net in C#.

The actor model is a programming paradigm that is based on asynchronous, message-driven architecture. In this paradigm, the basic unit of execution is an actor. This programming paradigm is suitable for building large-scale, complex, distributed applications that are highly reliable, but may have unpredictable degrees of latency.

The object-oriented programming approach uses classes and objects to model the problem domain. When working in Akka.Net, you use actors and messages to model your problem. In Akka.Net, an actor is an object with some specific behavior. While actors do have internal state, they don’t have any shared mutable state. You can have many concurrent actors in your application with each of them processing operations independently on their own. Actors are identified by addresses. They derive from the ActorBase class and in turn they can create child actors.

Actors communicate with each other by passing messages asynchronously. Essentially, an actor receives a message and then reacts to it either by processing it or by passing another message to another actor to get the job done. Note that the messages in Akka.Net are processed sequentially, one at a time, in the order in which they arrive. Since actors can be running locally or on a remote server, a common message exchange format is needed. Akka.Net messages are immutable. They can be instances of a string, an integer, or even a custom class.