forked from petabridge/akkadotnet-code-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrackerService.cs
30 lines (26 loc) · 1006 Bytes
/
TrackerService.cs
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
using Akka.Actor;
using Topshelf;
using WebCrawler.TrackingService.Actors;
using WebCrawler.TrackingService.Actors.Downloads;
namespace WebCrawler.TrackingService
{
public class TrackerService : ServiceControl
{
protected ActorSystem ClusterSystem;
protected IActorRef ApiMaster;
protected IActorRef DownloadMaster;
public bool Start(HostControl hostControl)
{
ClusterSystem = ActorSystem.Create("webcrawler");
ApiMaster = ClusterSystem.ActorOf(Props.Create(() => new ApiMaster()), "api");
DownloadMaster = ClusterSystem.ActorOf(Props.Create(() => new DownloadsMaster()), "downloads");
//ApiMaster.Tell(new StartJob(new CrawlJob(new Uri("http://www.rottentomatoes.com/", UriKind.Absolute), true), ghettoConsoleActor));
return true;
}
public bool Stop(HostControl hostControl)
{
ClusterSystem.Shutdown();
return true;
}
}
}