-
-
Save nvivo/a577aef54d954e339af3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Akka.Actor; | |
using Akka.Event; | |
using Akka.Routing; | |
using System; | |
namespace ConsoleApplication3 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var system = ActorSystem.Create("app"); | |
var props = new RoundRobinPool(10).Props(Props.Create<Worker>()); | |
var actor = system.ActorOf(props, "worker"); | |
for (var i = 0; i < 10; i++) | |
actor.Tell(i); | |
Console.ReadLine(); | |
} | |
class Worker : UntypedActor | |
{ | |
ILoggingAdapter Log = Context.GetLogger(); | |
protected override void OnReceive(object message) | |
{ | |
if (message as int? == 2) | |
throw new Exception(); | |
Log.Info("{0}", message); | |
} | |
public override void AroundPostRestart(Exception cause, object message) | |
{ | |
base.AroundPostRestart(cause, message); | |
Log.Info("PostRestart"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment