protected virtual bool SpecialHandle(object message, IActorRef sender)
{
var w = message as Watch;
if(w != null)
{
if(w.Watchee.Equals(this) && !w.Watcher.Equals(this))
{
w.Watcher.SendSystemMessage(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;
}
//todo: DeadLetterSupression
return false;
}
}