{"id":32520,"date":"2021-03-10T05:00:00","date_gmt":"2021-03-10T04:00:00","guid":{"rendered":"https:\/\/blexin.com\/?p=32520"},"modified":"2021-05-21T20:02:14","modified_gmt":"2021-05-21T18:02:14","slug":"build-scalable-and-resilient-applications-with-akka-actors","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/","title":{"rendered":"Build scalable and resilient applications with Akka Actors"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-32472\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A-1024x608.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">One of our clients working in the gaming field has commissioned us a platform for managing a virtual football championship, with both team and individual rankings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After analyzing the problem, we wonder how to create a platform that would keep updated rankings and statistics, even if the event is not strictly connected to them (such as a player&#8217;s goal or yellow card), maintaining the system scalable and resilient.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The best solution we found is to use Akka Actors, available on .NET in the Akka.NET package <a href=\"https:\/\/getakka.net\/articles\/intro\/what-is-akka.html\" target=\"_blank\" rel=\"noreferrer noopener\">(https:\/\/getakka.net\/articles\/intro\/what-is-akka.html<\/a>). They are successfully used in distributed systems and virtualized architectures, where components crash without responding, messages get lost, and the network is not stable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To deal with these issues, Akka.NET provides:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Multi-threaded behavior without using low-level concurrency constructs like atomics or locks<\/li><li>Transparent remote communication between systems and their components<\/li><li>A clustered, high-availability architecture that is elastic and scalable.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Developers can use packages such as Akka.Cluster and Akka.Cluster.Sharding, which allow configuring clusters to distribute actors across multiple nodes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Akka.NET&nbsp;is&nbsp;based&nbsp;on&nbsp;Actor&nbsp;model ((<a href=\"https:\/\/hal.archives-ouvertes.fr\/hal-01163534v7\/document\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/hal.archives-ouvertes.fr\/hal-01163534v7\/document<\/a>) pattern and gives us a library set to correctly implement this pattern so that we can get a higher abstraction level and easier design of concurrent, parallels, and distributed systems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Actor Model&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The basic characteristic of actors is that they model the world as stateful entities communicating with each other by passing&nbsp;messages.&nbsp;The actor model provides an abstraction that allows you to think about communication in your code.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Actors have these characteristics:&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>They communicate with asynchronous messaging<\/li><li>They&nbsp;manage&nbsp;their&nbsp;own&nbsp;state&nbsp;&nbsp;<\/li><li>When responding to a message, they can:&nbsp;&nbsp;<ul><li>Create&nbsp;child&nbsp;actors&nbsp;<\/li><li>Send&nbsp;messages&nbsp;to&nbsp;other&nbsp;actors&nbsp;<\/li><li>Stop&nbsp;child&nbsp;actors&nbsp;or&nbsp;themselves&nbsp;<\/li><\/ul><\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Consequently, in the actor model, two actors will never share the same memory nor directly change another actor\u2019s status. It will always have to send a message to the actor it wants to change, and the receiving actor will take care of receiving and processing the message.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"555\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/ActorModel.png?resize=1024%2C555&#038;ssl=1\" alt=\"Actor Model\" class=\"wp-image-32480\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/ActorModel-980x531.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/ActorModel-480x260.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Application architecture&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2018s introduce our solution, either taking a look at Akka Actors architecture.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It will be composed of a front-end Angular App, a Web API .NET Core actor-based layer that supports long polling using the SignalR hub, and an events simulator.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"364\" data-attachment-id=\"32483\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/attachment\/applicationdiagram-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/ApplicationDiagram.png?fit=595%2C364&amp;ssl=1\" data-orig-size=\"595,364\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"ApplicationDiagram\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/ApplicationDiagram.png?fit=595%2C364&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/ApplicationDiagram.png?resize=595%2C364&#038;ssl=1\" alt=\"Application diagram\" class=\"wp-image-32483\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/ApplicationDiagram.png 595w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/ApplicationDiagram-480x294.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 595px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When one creates an actor in Akka.NET it always belongs to a certain parent. That&#8217;s because actors are always organized into a tree, and creating an actor can only happen inside another actor. Hierarchically, the created actor becomes a child of the parent it was created from.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At the top of this tree, there&#8217;s a default layer containing three actors: <strong>root guardian<\/strong> (\/), parent of all system actors, with tho children, <strong>user guardian<\/strong> (\/user), parent of all user-created actors, and <strong>system guardian<\/strong> (\/system), that is to achieve an orderly shut-down sequence where logging remains active.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These built-in actors&#8217; names contain the word \u201c<em>guardian<\/em>\u201d because these are supervising every actor living as a child of them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"373\" data-attachment-id=\"32487\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/attachment\/akka-three-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Akka-Three.png?fit=658%2C373&amp;ssl=1\" data-orig-size=\"658,373\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Akka-Three\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Akka-Three.png?fit=658%2C373&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Akka-Three.png?resize=658%2C373&#038;ssl=1\" alt=\"Akka tree\" class=\"wp-image-32487\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/Akka-Three.png 658w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/Akka-Three-480x272.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 658px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In our project, we\u2019ve introduced three kinds of actors: two top-level as MatchesActor, which is used to update data of all matches, and StandingsActor, to update standings data; and one second-level actor, MatchActor, that manages single match data.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar firstRef = System.ActorOf(Props.Create(() =&gt; new MatchesActor()), &quot;matches&quot;); \n\nConsole.WriteLine($&quot;First: {firstRef}&quot;); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">It returns as output:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nFirst: Actor&#x5B;akka:\/\/akkaActors\/user\/matches#1213311313] \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In our project top-level actors configuration is defined in ActorsEnvironment -&gt; Configure method:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic static ActorsEnvironment Configure(IServiceProvider provider) \n\n{ \n\n        var hubContext = provider.GetService&lt;IHubContext&lt;Hub&gt;&gt;(); \n\n        var system = ActorSystem.Create(&quot;akkaActors&quot;); \n \n        system.ActorOf(Props.Create(() =&gt; new MatchesActor()), &quot;matches&quot;); \n        system.ActorOf(Props.Create(() =&gt; new StandingsActor()), &quot;standings&quot;); \n\n        return new ActorsEnvironment(system); \n\n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This method is called in Startup.cs, in Configure Services:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n services.AddSingleton&lt;ActorsEnvironment&gt;(context =&gt; ActorsEnvironment.CreateAndConfigure(context));\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this case, top-level actor MatchesActor has \/user\/matches path.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We also defined constants for actors path, so that we can easily use them.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class ActorPaths \n\n{ \n        public const string MatchesActor = &quot;\/user\/matches&quot;; \n        public const string StandingsActor = &quot;\/user\/standings&quot;; \n        public const string SignalRActor = &quot;\/user\/signalR&quot;; \n\n        public const string AllActors = &quot;\/user\/*\/*&quot;; \n } \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">To create non-top-level actors, we can call Context.ActorOf() from parent actor, as it follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MatchActor : UntypedActor \n{ \n} \n\npublic class MatchesActor : UntypedActor \n{ \n\n        protected override void OnReceive(object message) \n        { \n                switch (message) \n                { \n                        case &quot;create-new&quot;: \n                        IActorRef secondRef = Context.ActorOf(Props.Create(() =&gt; new MatchActor()), $&quot;first-match&quot;); \n                        Console.WriteLine($&quot;Second: {secondRef}&quot;); \n                        break; \n                } \n        } \n} \n\nvar firstRef = Sys.ActorOf(Props.Create&lt;MatchesActor&gt;(), &quot;matches&quot;); \nConsole.WriteLine($&quot;First: {firstRef}&quot;); \nfirstRef.Tell(&quot;create-new&quot;, ActorRefs.NoSender); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this way, we\u2019re creating a first-level actor and print its reference and, after that, we send it a message containing child id to create (if not existing yet), then we print child reference.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generated output is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nFirst : Actor&#x5B;akka:\/\/akkaActors\/user\/matches#1213311313] \nSecond: Actor&#x5B;akka:\/\/akkaActors\/user\/matches\/first-match#12261716] \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Life cycle&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Stopping an actor can be done by calling Context.Stop(actorRef). It is considered a bad practice to stop arbitrary actors this way. The recommended pattern is to call Context.Stop(self) inside an actor to stop itself, usually as a response to some user-defined stop message or when the actor is done with its job.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The actor API exposes many lifecycle hooks that the actor implementation can override. The most commonly used are PreStart() and PostStop().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PreStart() is invoked after the actor has started but before it processes its first message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PostStop() is invoked just before the actor stops.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our case:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MatchActor : ReceiveActor \n{ \n        protected override void PreStart() \n        { \n                Console.WriteLine($&quot;Match actor {Self.Path.Name} started&quot;); \n        } \n\n        protected override void PostStop() \n        { \n                Console.WriteLine($&quot;Match actor {Self.Path.Name} stopped&quot;); \n        } \n\n} \n\npublic class MatchesActor : ReceiveActor \n{ \n        protected override void PreStart() \n        { \n                Console.WriteLine($&quot;Matches actor {Self.Path.Name} started&quot;); \n        } \n\n        protected override void PostStop() \n        { \n                Console.WriteLine($&quot;Matches actor {Self.Path.Name} stopped&quot;); \n        } \n\n        protected override void OnReceive(object message) \n        { \n                switch (message) \n                { \n                        case &quot;create-new&quot;: \n                                IActorRef secondRef = Context.ActorOf(Props.Create(() =&gt; new MatchActor()), $&quot;first-match&quot;); \n                        \n                                break;             \n                        case &quot;stop&quot;: \n                                Context.Stop(Self); \n                                break;             \n                }   \n\n        }\n \n} \n\nvar firstRef = Sys.ActorOf(Props.Create&lt;MatchesActor&gt;(), &quot;matches&quot;); \nfirstRef.Tell(&quot;create-new&quot;, ActorRefs.NoSender); \nfirstRef.Tell(&quot;stop&quot;); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Generated output is:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nMatches actor matches started \nMatch actor first-match started \nMatch actor first-match stopped \nMatches actor matches stopped \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We deduce that all PostStop() hooks of the children are called before the PostStop() hook of the parent is called.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Error management&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Whenever an actor fails, it is temporarily suspended, and the failure information is propagated to the parent, which decides how to handle the exception caused by the child actor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The default supervisor strategy is to stop and restart the child.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MatchActor : ReceiveActor \n{ \n        protected override void PreStart() \n        { \n                Console.WriteLine($&quot;Match actor {Self.Path.Name} started&quot;); \n        } \n\n        protected override void PostStop() \n        { \n                Console.WriteLine($&quot;Match actor {Self.Path.Name} stopped&quot;); \n        } \n\n        protected override void OnReceive(object message) \n        { \n                switch (message) \n                { \n                        case &quot;fail&quot;: \n                                Console.WriteLine(&quot;Match actor fails&quot;); \n                                throw new Exception(&quot;I failed!&quot;); \n                } \n        } \n} \n\npublic class MatchesActor : ReceiveActor \n { \n        protected override void PreStart() \n        { \n                Console.WriteLine($&quot;Matches actor {Self.Path.Name} started&quot;); \n        } \n\n        protected override void PostStop() \n        { \n                Console.WriteLine($&quot;Matches actor {Self.Path.Name} stopped&quot;); \n        } \n\n\nprotected override void OnReceive(object message) \n        { \n                switch (message) \n                { \n                        case &quot;fail-child&quot;: \n                                IActorRef child = Context.ActorOf(Props.Create(() =&gt; new MatchActor()), $&quot;first-match&quot;); \n\n                                child.Tell(&quot;fail&quot;); \n                                break;             \n                } \n\n        } \n\n  } \n\nvar firstRef = Sys.ActorOf(Props.Create&lt;MatchesActor&gt;(), &quot;matches&quot;); \nfirstRef.Tell(&quot;fail-child&quot;, ActorRefs.NoSender); \nfirstRef.Tell(&quot;stop&quot;); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The generated output is:&nbsp;&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nMatches actor matches started \nMatch actor first-match started \nMatch actor fails \nMatches actor matches stopped \nMatches actor matches started \n\n&#x5B;ERROR]&#x5B;11.02.2021 13:34:50]&#x5B;Thread 0003]&#x5B;akka:\/\/akkaActors\/user\/matches\/first-match] I failed! \nCause: System.Exception: I failed! \n   at AkkaActors.MatchActor.OnReceive(Object message) \n   at Akka.Actor.UntypedActor.Receive(Object message) \n   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message) \n   at Akka.Actor.ActorCell.ReceiveMessage(Object message) \n   at Akka.Actor.ActorCell.Invoke(Envelope envelope) \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We see that after failure the actor is stopped and immediately started. If one prefers to have a different behaviour between first execution and the other ones, it\u2019s enough to override PreRestart() and PostRestart() methods.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have 3 kind of events managed by MatchesActor:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>MatchStarted,<\/li><li>MatchEnded&nbsp;<\/li><li>MatchScoreChanged.&nbsp;<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">defined as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MatchStarted \n{ \n        public int MatchId { get; set; } \n} \n\n public class MatchEnded \n{ \n        public int MatchId { get; set; } \n} \n\n public class MatchScoreChanged \n{ \n        public int MatchId { get; set; } \n        public int Team1Score { get; set; } \n        public int Team2Score { get; set; } \n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">They are managed by handlers registered in MatchesActor class:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic MatchesActor() \n{ \n        ReceiveAsync&lt;MatchStarted&gt;(request =&gt; Handle(request)); \n        ReceiveAsync&lt;MatchEnded&gt;(request =&gt; Handle(request)); \n        ReceiveAsync&lt;MatchScoreChanged&gt;(request =&gt; Handle(request)); \n} \n\nprivate IActorRef GetMatchActor(int matchId) \n{ \n        var childActor = Context.Child($&quot;{matchId}&quot;); \n\n        if (childActor is Nobody) \n        { \n                childActor = Context.ActorOf(Props.Create(() =&gt; new MatchActor()), $&quot;{matchId}&quot;); \n        } \n\n         return childActor; \n\n} \n\n private async Task Handle(MatchStarted request) \n{ \n        var child = GetMatchActor(request.MatchId); \n        child.Forward(request); \n} \n \/\/ &#x5B;...] \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this way, message will be forwarded to correct MatchActor that knows how to manage them.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic MatchActor() \n{ \n        ReceiveAsync&lt;MatchStarted&gt;(request =&gt; Handle(request)); \n        ReceiveAsync&lt;MatchEnded&gt;(request =&gt; Handle(request)); \n        ReceiveAsync&lt;MatchScoreChanged&gt;(request =&gt; Handle(request)); \n} \n\n private async Task Handle(MatchStarted request) \n{ \n        CurrentMatch.Started = true; \n        CurrentMatch.Team1Score = 0; \n        CurrentMatch.Team2Score = 0; \n\n         Context.ActorSelection(ActorPaths.StandingsActor).Tell(new StandingsChanged() {  \n                Teams = new Dictionary&lt;string, int&gt;() \n                { \n                        { CurrentMatch.Team1, 1 }, \n                        { CurrentMatch.Team2, 1 } \n                } \n\n        }); \n        Context.ActorSelection(ActorPaths.SignalRActor).Tell(request); \n\n} \n \/\/ &#x5B;...] \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Where StandingsChanges is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class StandingsChanged \n{ \n        public Dictionary&lt;string, int&gt; Teams { get; set; } \n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">MancheActor manages the ranking update logic and first forwards the message to the StandingsActor, which updates the ranking and is defined as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class StandingsActor : ReceiveActor \n{ \n        private Standings CurrentStandings { get; set; } \n        public StandingsActor() \n\n        { \n                Receive&lt;StandingsChanged&gt;(request =&gt; Handle(request)); \n        } \n  \n        private void Handle(StandingsChanged request) \n        { \n                CurrentStandings = new Standings() \n                { \n                        Teams = request.Teams \n                }; \n\n                Context.ActorSelection(ActorPaths.SignalRActor).Tell(request); \n\n        } \n\n }  \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">If needed, events could be forwarded to SignalRActor, which will poll in broadcast data to be shown in the UI, basing on the type of message to manage.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class SignalRActor : ReceiveActor \n{ \n        private readonly IHubContext&lt;Hub&gt; hubContext; \n\n        public SignalRActor(IHubContext&lt;Hub&gt; hubContext) \n        { \n                this.hubContext = hubContext; \n\n                Receive&lt;MatchStarted&gt;(message =&gt; Handle(message)); \n                Receive&lt;MatchEnded&gt;(message =&gt; Handle(message)); \n                Receive&lt;MatchScoreChanged&gt;(message =&gt; Handle(message)); \n                Receive&lt;StandingsChanged&gt;(message =&gt; Handle(message)); \n\n        } \n\n         private void Handle(MatchStarted message) \n        { \n                hubContext.Clients.All.SendAsync(&quot;BroadcastMatchStarted&quot;, message); \n        } \n  \n        private void Handle(MatchEnded message) \n        { \n                hubContext.Clients.All.SendAsync(&quot;BroadcastMatchEnded&quot;, message); \n        } \n\n        private void Handle(MatchScoreChanged message) \n        { \n                hubContext.Clients.All.SendAsync(&quot;BroadcastMatchScoreChanged&quot;, message); \n        } \n  \n        private void Handle(StandingsChanged message) \n        { \n                 hubContext.Clients.All.SendAsync(&quot;BroadcastStandingsChanged&quot;, message); \n        } \n\n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Our Web API controllers use actors and perform operation by using them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, in MatchesController class there are 3 endpoints to modify match status:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n &#x5B;HttpPut] \n&#x5B;Route(&quot;{matchId}\/start&quot;)] \npublic IActionResult StartMatch(int matchId) \n{ \n        environment \n                .SelectActor(ActorPaths.MatchesActor) \n                .Tell(new MatchStarted \n                { \n                        MatchId = matchId \n                }); \n\n         return Ok(); \n\n} \n\n&#x5B;HttpPut] \n&#x5B;Route(&quot;{matchId}\/stop&quot;)] \npublic IActionResult StopMatch(int matchId) \n{ \n        environment \n                .SelectActor(ActorPaths.MatchesActor) \n                .Tell(new MatchEnded \n                { \n                        MatchId = matchId \n                }); \n\n        return Ok(); \n\n} \n \n&#x5B;HttpPut] \n&#x5B;Route(&quot;{matchId}\/changescore\/{team1Score}\/{team2Score}&quot;)] \npublic IActionResult ChangeScore(int matchId, int team1Score, int team2Score) \n{ \n        environment \n                .SelectActor(ActorPaths.MatchesActor) \n                .Tell(new MatchScoreChanged \n                { \n                        MatchId = matchId, \n                        Team1Score = team1Score, \n                        Team2Score = team2Score \n                }); \n  \n        return Ok(); \n\n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The front-end application is a simple Angular app using a SignalRService that intercepts communications with SignalRHub:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nexport class SignalRService { \n        private hub: HubConnection; \n        \n        constructor() { \n                this.hub = new signalR.HubConnectionBuilder() \n                       \t.withUrl(`${environment.websocketUrl}akkaActorsHub`) \n        \t\t.build(); \n\n                this.hub.start().then(() =&gt; { \n               \t        console.log(`Hub connection started`); \n    \t\t        }).catch(err =&gt; document.write(err)); \n\n        } \n\n         public on&lt;T&gt;(name: string): Observable&lt;T&gt; { \n                const subject = new Subject&lt;T&gt;(); \n\n                this.hub.on(name, (data) =&gt; { \n                subject.next(data); \n                }); \n\n                return subject.asObservable(); \n\n        } \n\n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This class is injected in a Angular components that need it, in their ngOnInit method, in this way:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nngOnInit() { \n        const onMatchScoreChanged$: Observable&lt;any&gt; = this.signalR.on(`BroadcastMatchScoreChanged`); \n        onMatchScoreChanged$.subscribe((message: any) =&gt; { \n                \/\/Do something \n        }); \n        } \n}); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">For test purposes we created an events simulator that performs some event, like match starting, ending and score changings, before stopping them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Events are sent on REST protocol to Web API:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nprivate static void Send(string endpoint, StringContent content) \n{ \n        _client.PostAsync(endpoint, content).Wait(); \n} \n\n static void Main(string&#x5B;] args) \n{ \n        _client = new HttpClient { BaseAddress = new Uri(&quot;http:\/\/localhost:5000&quot;) }; \n\n        _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(&quot;application\/json&quot;)); \n\n        Send(&quot;api\/matches\/1\/start&quot;, &quot;&quot;); \n        Send(&quot;api\/matches\/2\/start&quot;, &quot;&quot;); \n\n        var content = new StringContent(JsonConvert.SerializeObject(new \n        { \n                Team1Score = 1, \n                Team2Score = 0 \n        }), Encoding.UTF8, &quot;application\/json&quot;); \n\n        Send(&quot;api\/matches\/2\/updatescore&quot;, content); \n\n        \/\/ other events\u2026 \n\n        Send(&quot;api\/matches\/2\/stop&quot;, &quot;&quot;); \n        Send(&quot;api\/matches\/1\/stop&quot;, &quot;&quot;); \n\n}\t \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project execution&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When running our test solution, we can get a dashboard with data refreshed each time an event from the simulator comes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"384\" data-attachment-id=\"32506\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/attachment\/application-running-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Application-Running.png?fit=975%2C384&amp;ssl=1\" data-orig-size=\"975,384\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Application-Running\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Application-Running.png?fit=975%2C384&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/Application-Running.png?resize=975%2C384&#038;ssl=1\" alt=\"application running\" class=\"wp-image-32506\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/Application-Running.png 975w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/Application-Running-480x189.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 975px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I wish I have aroused your interest in the topic. On our blog, you can find other articles about the software architecture. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The source code used in this post is <a href=\"https:\/\/github.com\/enricobencivenga\/AkkaActors\" target=\"_blank\" rel=\"noreferrer noopener\">available here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To the next article<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s see how to implement Actor Model in .NET<\/p>\n","protected":false},"author":196716247,"featured_media":32473,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"808","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_crdt_document":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637421,688637542,688637384,688637537],"class_list":["post-32520","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-net-en","tag-dotnetcore-en","tag-c-en","tag-swdesign-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Build scalable and resilient applications with Akka Actors - Blexin<\/title>\n<meta name=\"description\" content=\"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build scalable and resilient applications with Akka Actors - Blexin\" \/>\n<meta property=\"og:description\" content=\"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-10T04:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-21T18:02:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1105\" \/>\n\t<meta property=\"og:image:height\" content=\"656\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Enrico Bencivenga\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Enrico Bencivenga\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/\"},\"author\":{\"name\":\"Enrico Bencivenga\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/74e4443d1d7ad12d5b4a8db7f63f0194\"},\"headline\":\"Build scalable and resilient applications with Akka Actors\",\"datePublished\":\"2021-03-10T04:00:00+00:00\",\"dateModified\":\"2021-05-21T18:02:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/\"},\"wordCount\":1146,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1\",\"keywords\":[\".Net\",\".NetCore\",\"C#\",\"softwaredesign\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/\",\"name\":\"Build scalable and resilient applications with Akka Actors - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1\",\"datePublished\":\"2021-03-10T04:00:00+00:00\",\"dateModified\":\"2021-05-21T18:02:14+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/74e4443d1d7ad12d5b4a8db7f63f0194\"},\"description\":\"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1\",\"width\":1105,\"height\":656},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/build-scalable-and-resilient-applications-with-akka-actors\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build scalable and resilient applications with Akka Actors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/74e4443d1d7ad12d5b4a8db7f63f0194\",\"name\":\"Enrico Bencivenga\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g\",\"caption\":\"Enrico Bencivenga\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/enrico-bencivengablexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Build scalable and resilient applications with Akka Actors - Blexin","description":"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/","og_locale":"en_US","og_type":"article","og_title":"Build scalable and resilient applications with Akka Actors - Blexin","og_description":"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.","og_url":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/","og_site_name":"Blexin","article_published_time":"2021-03-10T04:00:00+00:00","article_modified_time":"2021-05-21T18:02:14+00:00","og_image":[{"width":1105,"height":656,"url":"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","type":"image\/png"}],"author":"Enrico Bencivenga","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Enrico Bencivenga","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/"},"author":{"name":"Enrico Bencivenga","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/74e4443d1d7ad12d5b4a8db7f63f0194"},"headline":"Build scalable and resilient applications with Akka Actors","datePublished":"2021-03-10T04:00:00+00:00","dateModified":"2021-05-21T18:02:14+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/"},"wordCount":1146,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","keywords":[".Net",".NetCore","C#","softwaredesign"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/","url":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/","name":"Build scalable and resilient applications with Akka Actors - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","datePublished":"2021-03-10T04:00:00+00:00","dateModified":"2021-05-21T18:02:14+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/74e4443d1d7ad12d5b4a8db7f63f0194"},"description":"With Akkaa ctor you can model your .NET applications to allow asynchronous communication between components.","breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","width":1105,"height":656},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/build-scalable-and-resilient-applications-with-akka-actors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Build scalable and resilient applications with Akka Actors"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/74e4443d1d7ad12d5b4a8db7f63f0194","name":"Enrico Bencivenga","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ea7187309674789d6f02c6b757e1f21c8cf800abb2419b4edaa8b09d4c99548?s=96&d=identicon&r=g","caption":"Enrico Bencivenga"},"url":"https:\/\/blexin.com\/en\/author\/enrico-bencivengablexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/6_21_1105x656_blog-actormodel-A.png?fit=1105%2C656&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-8sw","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716247"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=32520"}],"version-history":[{"count":15,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32520\/revisions"}],"predecessor-version":[{"id":32663,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32520\/revisions\/32663"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/32473"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=32520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=32520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=32520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}