本文整理汇总了C#中Akka.Actor.ActorRef.IsNobody方法的典型用法代码示例。如果您正苦于以下问题:C# ActorRef.IsNobody方法的具体用法?C# ActorRef.IsNobody怎么用?C# ActorRef.IsNobody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Actor.ActorRef
的用法示例。
在下文中一共展示了ActorRef.IsNobody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Receive
/// <summary>
/// Directly inject messages into actor receive behavior. Any exceptions
/// thrown will be available to you, while still being able to use
/// become/unbecome.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="sender">The sender.</param>
public void Receive(object message, ActorRef sender = null)
{
var cell = Cell;
sender = sender.IsNobody() ? cell.System.DeadLetters : sender;
var envelope = new Envelope { Message = message, Sender = sender };
cell.UseThreadContext(() => cell.ReceiveMessageForTest(envelope));
}
示例2: SendUserMessage
protected virtual void SendUserMessage(object message, ActorRef sender)
{
if(message == null) throw new InvalidMessageException();
var deadLetter = message as DeadLetter;
if(deadLetter != null)
HandleDeadLetter(deadLetter);
else
{
var wasHandled = SpecialHandle(message, sender);
if(!wasHandled)
{
_eventStream.Publish(new DeadLetter(message, sender.IsNobody() ? _provider.DeadLetters : sender, this));
}
}
}
示例3: SpecialHandle
protected virtual bool SpecialHandle(object message, ActorRef sender)
{
var w = message as Watch;
if(w != null)
{
if(w.Watchee == this && w.Watcher != this)
{
w.Watcher.Tell(new DeathWatchNotification(w.Watchee, existenceConfirmed: false, addressTerminated: false));
}
return true;
}
if(message is Unwatch)
return true; //Just ignore
var identify = message as Identify;
if(identify != null)
{
sender.Tell(new ActorIdentity(identify.MessageId, null));
return true;
}
var sel = message as ActorSelectionMessage;
if(sel != null)
{
var selectionIdentify = sel.Message as Identify;
if(selectionIdentify != null)
{
if(!sel.WildCardFanOut)
sender.Tell(new ActorIdentity(selectionIdentify.MessageId, null));
}
else
{
_eventStream.Publish(new DeadLetter(sel.Message, sender.IsNobody() ? _provider.DeadLetters : sender, this));
}
return true;
}
return false;
}