当前位置: 首页>>代码示例>>C#>>正文


C# IActorRef.IsNobody方法代码示例

本文整理汇总了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));
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:14,代码来源:InternalTestActorRef.cs

示例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));
     }
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:10,代码来源:EmptyLocalActorRef.cs

示例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));
         }
     }
 }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:15,代码来源:EmptyLocalActorRef.cs

示例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;
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:46,代码来源:EmptyLocalActorRef.cs

示例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;
 }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:36,代码来源:EmptyLocalActorRef.cs


注:本文中的IActorRef.IsNobody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。