Skip to content

Instantly share code, notes, and snippets.

@nvivo
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvivo/a577aef54d954e339af3 to your computer and use it in GitHub Desktop.
Save nvivo/a577aef54d954e339af3 to your computer and use it in GitHub Desktop.
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