Description
Course info
Rating
(49)
Level
Intermediate
Updated
Jul 22, 2016
Duration
1h 40m
Description

Akka.NET makes building concurrent, scalable, reactive, self-healing, and distributed systems easier. Even though Akka.NET actors help you to manage concurrency, by default they only exist in-memory. In this course, Akka.NET Persistence Fundamentals, you're going to learn about the core features of Akka.NET Persistence and how you can use these features to restore the internal actor state if the actor restarts or the server crashes. First you'll learn how to refactor existing actors to be persistent. Next, you'll learn about how Akka.Persistence supports multiple back-end data stores. Finally, you'll learn how to improve actor recovery speeds by using optional snapshots. By the end of this course, you'll understand how to get started creating persistent actors that can restore their state, how to configure a persistence back-end store such as SQL Server, how to think in terms of events and commands, and how to implement performance-improving snapshots.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Introduction to .NET Testing with NUnit 3
Intermediate
2h 6m
Dec 17, 2018
Working with Files and Streams in C#
Intermediate
3h 13m
Oct 12, 2018
Error Handling in C# with Exceptions
Intermediate
1h 37m
Aug 6, 2018
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name's Jason Roberts. Welcome to my course, Akka. NET Persistence Fundamentals. I'm a Microsoft. NET MVP, freelance developer, and author. In this course we're going to learn about the core features of Akka. NET persistence and how we can use these features to restore internal actor state if the actor restarts or the server crashes. Some of the major topics that we'll cover in this course include why we might want to use persistent actors and the problems they solve, how to refactor existing actors to be persistent, how Akka. Persistence supports multiple back-end data stores, and how to improve actor recovery speeds by using optional snapshots. By the end of this course, you'll understand how to get started creating persistent actors that can restore their state, how to configure a persistent back-end store such as SQL Server, how to think in terms of events and commands, and how to implement performance improving snapshots. Before beginning the course, you should be familiar writing C# code in Visual Studio, and also the fundamentals of Akka. NET, such as the concepts of actors and messages. I hope you'll join me on this journey with the Akka. NET Persistence Fundamentals course at Pluralsight.

Introduction to Persistent Actors
Hi, I'm Jason Roberts from Pluralsight. Welcome to this course on Akka. NET Persistence Fundamentals. In this first module, we're going to be getting an introduction to persistent actors. So we're going to start off by looking at why we might to use persistent actors in our Akka. NET solution. We'll learn about the architecture of Akka. NET persistence, such as how we can store messages sent to an actor in a back-end event journal store. We'll look at the different persistence stores that are available, such as SQL Server or MySQL, and we'll learn about the concept of snapshots, and how they enable us to recover actor state more quickly. We'll learn that Akka. NET persistence also provides the At-Least-Once message delivery pattern, we'll get an outline of the rest of the modules in this course, and then we'll see a demo of what happens if we're not using persistent actors, and how this can result in the loss of the internal state of our actors.

Thinking in Events and Commands
Hi, welcome back. In the previous module we learned how we can persist and restore messages to a back-end journal store. In this module we're going to be thinking a bit more formally about the difference between events and commands. So we're going to kick off this module by understanding the differences between events and commands. We'll learn that an actor receives a command, and then can persist an event to the back-end journal store. These events can later be replayed. We'll then jump in to Visual Studio, and we'll start to refactor our code from the previous module. So we'll start off by changing the message classes that we have into events and commands. Now we have our events and commands, we'll go and refactor our PlayerCoordinatorActor to make use of these new event and command classes. We'll then go and do the same thing for our PlayerActor, once again making our actor respond to commands, and storing events in the journal store. So let's start off by looking at the differences between events and commands.

Improving Actor Recovery Time with Snapshots
Hi, welcome back to this final module. In this module we're going to see how we can use the concept of snapshots to improve our actor recovery times, if we have a lot of events in the journal store. So, in this module we're going to start off by getting an understanding of what snapshots are, and the problem they solve. We'll then jump into Visual Studio, and we'll have a look at configuring the snapshot store in our HOCON configuration, and we'll also see this new PlayerActorState class that's going to hold the state that gets saved as a snapshot. We'll then go and write code to save a snapshot after every five events are persisted in the journal store. Next we'll add code to actually retrieve the snapshots, and we'll see that when we do this, Akka. NET offers us a snapshot to use, and we can use the contents of this snapshot to update our PlayerActorState. We'll then see that when we restart the application, we don't get all of the journal events played, we instead get only those journal events that were added since the last snapshot was created. This reduces the number of overall events that are going to be replayed by our actor.