// Create ActorSystem
var actorSystem = akkaService.CreateActorSystem();
// Create Actor
var currentActor = actorSystem.ActorOf(Props.Create<BasicActor>(), actorName);
// Send Message
currentActor.Tell(new MessageCommand("Hello"));
// Actor Implement
public class BasicActor : ReceiveActor
{
private readonly ILoggingAdapter logger = Context.GetLogger();
private IActorRef testProbe;
public BasicActor()
{
ReceiveAsync<IActorRef>(async actorRef =>
{
testProbe = actorRef;
testProbe.Tell("done");
});
ReceiveAsync<MessageCommand>(async msg =>
{
if (testProbe != null)
{
testProbe.Tell(msg.Message);
}
else
{
Sender.Tell(msg.Message);
}
});
}
}
actor
기본 액터를 생성하고 메시지를 전송합니다.