Today we’re going to learn about one of the really cool things actors can do: change their behavior at run-time!

This capability allows you to do all sorts of cool stuff, like build Finite State Machines (FSM) or change how your actors handle messages based on other messages they’ve received.

Today, we’re going to cover how to make a basic FSM using switchable behavior. We’ll go over advanced FSM approaches in a future post.

Let’s start with a real-world scenario in which you’d want the ability to change an actor’s behavior.

Real-world Scenario: Authentication

Imagine you’re building a simple chat system using Akka.NET actors, and here’s what your UserActor looks like - this is the actor that is responsible for all communication to and from a specific human user.

public class UserActor : ReceiveActor { private readonly string _userId; private readonly string _chatRoomId; public UserActor(string userId, string chatRoomId) { _userId = userId; _chatRoomId = chatRoomId; Receive<IncomingMessage>(inc => inc.ChatRoomId == _chatRoomId, inc => { // print message for user }); Receive<OutgoingMessage>(inc => inc.ChatRoomId == _chatRoomId, inc => { // send message to chatroom }); } } 

So we have basic chat working - yay! But… right now there’s nothing to guarantee that this user is who they say they are. This system needs some authentication.

How could...

Now that Akka.NET is leaving beta and hitting the 1.0 milestone, we’ve seen interest and production usage ramp up quickly.

The Last Few Months

Over the last two months, we’ve been working with several cutting-edge teams to help them rearchitect and build out new systems for use cases as diverse as citywide Internet of Things (IoT) monitoring, rearchitecting to microservices, and converting their ETL pipelines from batch to realtime.

Oh, and we’ve been teaching a lot of people the actor model and how to use Akka.NET through our Akka.NET Bootcamp and on-site training.

During that time, we got a little busy and forgot to announce this, so let’s fix that: Petabridge is now officially available for consulting, training, and support!

How We Can Help You


Get your Akka.NET projects out the door faster by getting some help from the people who work on it.

Whether you’re looking to rearchitect your system to use microservices, migrate from hacky batch processing to responsive + streaming ETL, or you want to build out scalable new capabilities from scratch, we can help you get there faster. We also have a special offering for combining Akka.NET with Cassandra.

In-person Training

Want to learn how Akka.Cluster and Akka.Persistence can help you build high availability systems easily? And how to integrate them with other technologies your company currently uses like ASP.NET, SignalR, NServiceBus, or Windows Azure?

Well, we do that!


Get fast resolutions to your issues with Akka.NET applications from members of the core engineering team.

In short, we can help you create the new system you’ve envisioned, train your team, and/or help you through whatever bugs come up in your system, saving you tens of thousands of dollars and hundreds of hours of aggravation.


Over the last several months, interest in Akka.NET has increased dramatically. And yet, many people find the actor model intimidating and can’t seem to really get up and running. Developers want to learn how to use Akka.NET, but where do they go? There haven’t been very many good answers to that question. Until now.

We decided to fix that.

And so…

Introducing Bootcamp

I’m pleased to announce that we’ve launched Akka.NET Bootcamp to provide this exact learning resource to developers everywhere!

Akka.NET Bootcamp

We put bootcamp together to help you learn the insanely powerful actor model in an accessible, fun way. The course starts from fundamentals and takes you all the way to knowing what you need to in order to create sophisticated, distributed apps in .NET.

What Is Bootcamp?

Bootcamp is a free, self-directed learning course. You can do it at whatever pace you wish. Bootcamp launched initially in C# only, but F# support is almost done. Hundreds of developers around the world are already members of Bootcamp.

Why Should I Do Bootcamp?

You know that you need to get ahead of the curve and learn about distributed computing, functional programming, and cloud computing. When we started learning about distributed computing, we were overwhelmed by the sheer amount of things we needed to know. Consistent hashing, consensus algorithms, PAXOS, Raft, replication strategies… the list goes on and on.