-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
70 lines (58 loc) · 2.3 KB
/
Copy pathProgram.cs
File metadata and controls
70 lines (58 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Akka.Actor;
using Akka.DI.CastleWindsor;
using Akka.Monitoring;
using Akka.Monitoring.Impl;
using Castle.Core;
using Castle.DynamicProxy;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Akka.AOP.Monitoring
{
class Program
{
public static AutoResetEvent ManualResetEvent = new AutoResetEvent(false);
private static ActorSystem system;
static void Main(string[] args)
{
using (system = ActorSystem.Create("akka-performance-demo"))
{
var registeredMonitor = ActorMonitoringExtension.RegisterMonitor(system, new Monitor());
IWindsorContainer container = new WindsorContainer();
container.Register( Component.For<IInterceptor>().
ImplementedBy<MonitorInterceptor>().
Named("monitorInterceptor"),
Component.For<HelloActor>().
LifestyleTransient().
Interceptors(InterceptorReference.ForKey("monitorInterceptor")).
Anywhere);
WindsorDependencyResolver propsResolver =
new WindsorDependencyResolver(container, system);
var hello = system.ActorOf(propsResolver.Create<HelloActor>(), "Worker1");
hello.Tell("What's Up");
hello.Tell("Goodbye");
var count = 20;
while (count >= 0)
{
ActorMonitoringExtension.Monitors(system).IncrementDebugsLogged();
Console.WriteLine("Logging debug...");
Thread.Sleep(100);
count--;
}
while (ManualResetEvent.WaitOne())
{
Console.WriteLine("Shutting down...");
system.Shutdown();
Console.WriteLine("Shutdown complete");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
return;
}
}
}
}
}