Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEmacs
using System;
using System.Collections.Generic;
using Akka.Actor;

namespace AkkaNetCore.Actors
{
    public class SingleToneActor : ReceiveActor
    {
        private readonly ILoggingAdapter logger = Context.GetLogger();
        private readonly string id;                   
        private IActorRef BatchWriter_Rev;
        private IActorRef BatchManager_Rev;
		
        public SingleToneActor()
        {
            BatchWriter_Rev = Context.ActorOf<BatchWriterActor>();
            BatchManager_Rev = Context.ActorOf(Props.Create(() => new BatchActor(10)));
            BatchManager_Rev.Tell(new SetTarget(BatchWriter_Rev));

            id = Guid.NewGuid().ToString();
            logger.Info($"싱글톤 액터 생성:{id}");
            startTime = DateTime.Now;            
            totalCount = 0;

            ReceiveAsync<DelayMsg>(async msg =>
            {
				BatchManager_Rev.Tell(new Queue(msg));
            });
        }
    }
}
//싱글톤 클러스터 액터작동                
var actor = AkkaBoostrap.BootstrapSingleton<SingleToneActor>(actorSystem, "SingleToneActor", "akkanet");
SingleToneActor = AkkaBoostrap.BootstrapSingletonProxy(actorSystem, "SingleToneActor", 
	"akkanet", "/user/SingleToneActor", "singleToneActorProxy");
git : https://github.com/psmon/AkkaForNetCore/blob/master/AkkaNetCore/Extensions/AkkaBoostrap.cs