本文整理汇总了C#中IActorRef.IsNobody方法的典型用法代码示例。如果您正苦于以下问题:C# IActorRef.IsNobody方法的具体用法?C# IActorRef.IsNobody怎么用?C# IActorRef.IsNobody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActorRef
的用法示例。
在下文中一共展示了IActorRef.IsNobody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, IActorRef 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: TellInternal
protected override void TellInternal(object message, IActorRef sender)
{
if(message == null) throw new InvalidMessageException("Message is null");
var d = message as DeadLetter;
if (d != null) SpecialHandle(d.Message, d.Sender);
else if (!SpecialHandle(message, sender))
{
_eventStream.Publish(new DeadLetter(message, sender.IsNobody() ? _provider.DeadLetters : sender, this));
}
}
示例3: SendUserMessage
protected virtual void SendUserMessage(object message, IActorRef 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));
}
}
}
示例4: SpecialHandle
protected virtual bool SpecialHandle(object message, IActorRef sender)
{
var watch = message as Watch;
if (watch != null)
{
if (watch.Watchee.Equals(this) && !watch.Watcher.Equals(this))
{
watch.Watcher.SendSystemMessage(new DeathWatchNotification(watch.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 actorSelectionMessage = message as ActorSelectionMessage;
if (actorSelectionMessage != null)
{
var selectionIdentify = actorSelectionMessage.Message as Identify;
if (selectionIdentify != null)
{
if (!actorSelectionMessage.WildCardFanOut)
sender.Tell(new ActorIdentity(selectionIdentify.MessageId, null));
}
else
{
_eventStream.Publish(new DeadLetter(actorSelectionMessage.Message, sender.IsNobody() ? _provider.DeadLetters : sender, this));
}
return true;
}
var deadLetterSuppression = message as IDeadLetterSuppression;
if (deadLetterSuppression != null)
{
_eventStream.Publish(new SuppressedDeadLetter(deadLetterSuppression, sender.IsNobody() ? _provider.DeadLetters : sender, this));
return true;
}
return false;
}
示例5: SpecialHandle
protected virtual bool SpecialHandle(object message, IActorRef 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;
}