Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
namespace MyActorWorkerRole { public class WorkerRole : RoleEntryPoint { private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); private readonly ManualResetEvent runCompleteEvent = new ManualResetEvent(false); private ActorSystem _actorSystem; public override bool OnStart() { // Setup the Actor System _actorSystem = ActorSystem.Create("MySystem"); return (base.OnStart()); } public override void OnStop() { this.cancellationTokenSource.Cancel(); this.runCompleteEvent.WaitOne(); // Shutdown the Actor System _actorSystem.Shutdown(); base.OnStop(); } public override void Run() { try { this.RunAsync(this.cancellationTokenSource.Token).Wait(); } finally { this.runCompleteEvent.Set(); } } private async Task RunAsync(CancellationToken cancellationToken) { // Create an instance to the top-level user Actor var workerRoleActor = _actorSystem.ActorOf<WorkerRoleActor>("WorkerRole"); // Send a message to the Actor workerRoleActor.Tell(new WorkerRoleMessage("Hello World!")); while (!cancellationToken.IsCancellationRequested) { await Task.Delay(1000); } } } } |
실습예정:
- Actor의 기능을 Asp.net 내에서 Restful과 연동
- IIS 비종속적인 StandAlone Webservice로 Actor연동 ( 마이크로 서비스를 위해서,리눅스 배포자동화및 구동 목표 )