Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: docker 이용추가

Table of Contents


Info

AkkaSystem 사용은 다양한 방식으로 실행화 할수 있습니다.

...

Code Block
languagec#
themeEmacs
linenumberstrue
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);
            }
        }
    }
}


Docker with .net CORE

개발환경에서 Docker 활용이 점점 중요화되고 있습니다.

최근 IDE툴들은 가상머신과 연동이 되어, 도커를 지원하고 있습니다.

도커로 구성된 컨테이너는 클라우드환경과 다양한 방법으로 배포가 가능해집니다.

참고 URL : .NET Core API for ORM(Entity)