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


C# IActorRef.Forward方法代码示例

本文整理汇总了C#中IActorRef.Forward方法的典型用法代码示例。如果您正苦于以下问题:C# IActorRef.Forward方法的具体用法?C# IActorRef.Forward怎么用?C# IActorRef.Forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IActorRef的用法示例。


在下文中一共展示了IActorRef.Forward方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestProjection

            public TestProjection(IActorRef probe)
            {
                _probe = probe;

                OnEvent<TestEvent>(e =>
                {
                    _probe.Forward(e);
                });

                OnQuery<TestQuery>(q =>
                {
                    _probe.Forward(q);
                });
            }
开发者ID:mwatts,项目名称:Even,代码行数:14,代码来源:ProjectionTests.cs

示例2: Master

        public Master()
        {
            mapper = Context.ActorOf(
                Props.Create<Mapper>()

                .WithRouter(new RoundRobinPool(NrMappers))
            );
            reducer = Context.ActorOf(
                Props.Create<Reducer>()
                     .WithRouter(new RoundRobinPool(NrReducers))
            );
            aggregator = Context.ActorOf(Props.Create<Aggregator>());

            // 1. forward a string to mapper
            Receive<string>(s => mapper.Tell(s));

            // 2. forward map result to reducer
            Receive<MapResult>(m => reducer.Tell(m));

            // 3. forward reduce result to aggregator
            Receive<ReduceResult>(r => aggregator.Tell(r));

            // allow asking for aggregated result at any time
            Receive<GetResult>(g => aggregator.Forward(g));
        }
开发者ID:wki,项目名称:AkkaDotNET_AdventCalendar,代码行数:25,代码来源:Master.cs

示例3: TestService

 public TestService(IActorRef testActorRef)
 {
     ReceiveAny(msg =>
     {
         testActorRef.Forward(msg);
         Sender.Tell(msg.ToString() + "-ack");
     });
 }
开发者ID:juergenhoetzel,项目名称:akka.net,代码行数:8,代码来源:ClusterClientSpec.cs

示例4: ForwardActor

            public ForwardActor(IActorRef testActor)
            {
                _testActor = testActor;
                Context.Parent.Tell("one");

                Receive<string>(s => s == "one", c =>
                {
                    _testActor.Forward("two");
                });
            }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:10,代码来源:RouteeCreationSpec.cs

示例5: ProbeRelay

 public ProbeRelay(IActorRef target)
 {
     ReceiveAny(o => target.Forward(o));
 }
开发者ID:Robin--,项目名称:Even,代码行数:4,代码来源:ProbeRelay.cs

示例6: ParentWithChildPropsActor

        public ParentWithChildPropsActor(Props childProps)
        {
            _childActor = Context.ActorOf(childProps, "child");

            Receive<ChildDoWorkMessage>(m => _childActor.Forward(m));
        }
开发者ID:DevEnable,项目名称:AkkaPlayground,代码行数:6,代码来源:ParentWithChildPropsActor.cs

示例7: Active

        private Receive Active(IActorRef receptionist)
        {
            return message =>
            {
                if (message is Send)
                {
                    var send = (Send)message;
                    receptionist.Forward(new PublishSubscribe.Send(send.Path, send.Message, send.LocalAffinity));
                }
                else if (message is SendToAll)
                {
                    var sendToAll = (SendToAll)message;
                    receptionist.Forward(new PublishSubscribe.SendToAll(sendToAll.Path, sendToAll.Message));
                }
                else if (message is Publish)
                {
                    var publish = (Publish)message;
                    receptionist.Forward(new PublishSubscribe.Publish(publish.Topic, publish.Message));
                }
                else if (message is HeartbeatTick)
                {
                    if (!_failureDetector.IsAvailable)
                    {
                        _log.Info("Lost contact with [{0}], restablishing connection", receptionist);
                        SendGetContacts();
                        ScheduleRefreshContactsTick(_settings.EstablishingGetContactsInterval);
                        Context.Become(Establishing);
                        _failureDetector.HeartBeat();
                    }
                    else
                    {
                        receptionist.Tell(ClusterReceptionist.Heartbeat.Instance);
                    }
                }
                else if (message is ClusterReceptionist.HeartbeatRsp)
                {
                    _failureDetector.HeartBeat();
                }
                else if (message is RefreshContactsTick)
                {
                    receptionist.Tell(ClusterReceptionist.GetContacts.Instance);
                }
                else if (message is ClusterReceptionist.Contacts)
                {
                    var contacts = (ClusterReceptionist.Contacts)message;

                    // refresh of contacts
                    if (contacts.ContactPoints.Count > 0)
                    {
                        _contactPaths = contacts.ContactPoints.Select(ActorPath.Parse).ToImmutableHashSet();
                        _contacts = _contactPaths.Select(Context.ActorSelection).ToArray();
                    }
                    PublishContactPoints();
                }
                else if (message is ActorIdentity)
                {
                    // ok, from previous establish, already handled
                }
                else
                {
                    return ContactPointMessages(message);
                }

                return true;
            };
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:66,代码来源:ClusterClient.cs

示例8: Active

 private Receive Active(IActorRef receptionist)
 {
     return message =>
         message.Match()
         .With<Send>(send =>
             receptionist.Forward(new Send(send.Path, send.Message, send.LocalAffinity)))
         .With<SendToAll>(toAll =>
             receptionist.Forward(new SendToAll(toAll.Path, toAll.Message)))
         .With<Publish>(publish =>
             receptionist.Forward(new Publish(publish.Topic, publish.Message)))
         .With<InternalMessage>(m =>
         {
             switch (m)
             {
                 case InternalMessage.HeartbeatTick:
                     if (!_failureDetector.IsAvailable)
                     {
                         Log.Info("Lost contact with [{0}], restablishing connection", receptionist);
                         SendGetContacts();
                         ScheduleRefreshContactsTick(Settings.EstablishingGetContactsInterval);
                         Context.Become(Establishing);
                         _failureDetector.HeartBeat();
                     }
                     else
                     {
                         receptionist.Tell(ClusterReceptionist.Heartbeat.Instance);
                     }
                     break;
                 case InternalMessage.RefreshContactsTick:
                     receptionist.Tell(ClusterReceptionist.GetContacts.Instance);
                     break;
             }
         })
         .With<ClusterReceptionist.HeartbeatRsp>(_ => _failureDetector.HeartBeat())
         .With<ClusterReceptionist.Contacts>(contacts =>
         {
             if (contacts.ContactPoints.Length != 0)
                 _contacts = contacts.ContactPoints.Select(Context.ActorSelection).ToArray();
         })
         .With<Terminated>(terminated =>
         {
             Log.Info("Lost contact with [{0}], restablishing connection", receptionist);
             SendGetContacts();
             ScheduleRefreshContactsTick(Settings.EstablishingGetContactsInterval);
             Context.Become(Establishing);
         })
         .With<ActorIdentity>(_ => { /* ok, from previous establish, already handled */ })
         .WasHandled;
 }
开发者ID:juergenhoetzel,项目名称:akka.net,代码行数:49,代码来源:ClusterClient.cs

示例9: ForwardTo

 private void ForwardTo( IActorRef sender, GithubValidatorActor.InvalidRepo repo )
 {
     sender.Forward( repo );
 }
开发者ID:njimenez,项目名称:AkkaProjects,代码行数:4,代码来源:GithubValidatorActor.cs

示例10: CreateWorkingWriter

        IActorRef CreateWorkingWriter(IActorRef relay = null)
        {
            return Sys.ActorOf(conf =>
            {
                conf.Receive<PersistenceRequest>((r, ctx) => {

                    if (relay != null)
                        relay.Forward(r);

                    ctx.Sender.Tell(new PersistenceSuccess(r.PersistenceID));
                });
            });
        }
开发者ID:promontis,项目名称:Even,代码行数:13,代码来源:AggregateTests.cs

示例11: ProbeActor

            public ProbeActor(IActorRef testActor)
            {
                _testActor = testActor;

                Receive<WatchIt>(w =>
                {
                    Context.Watch(w.Watchee);
                    Sender.Tell(Ack.Instance);
                });
                Receive<UnwatchIt>(w =>
                {
                    Context.Unwatch(w.Watchee);
                    Sender.Tell(Ack.Instance);
                });
                Receive<Terminated>(t => _testActor.Forward(new WrappedTerminated(t)));
                ReceiveAny(msg => _testActor.Forward(msg));
            }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:17,代码来源:RemoteNodeDeathWatchSpec.cs

示例12: ForwardActor

            public ForwardActor(IActorRef testActor)
            {
                _testActor = testActor;

                ReceiveAny(msg =>
                {
                    _testActor.Forward(msg);
                });
            }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:9,代码来源:RoutingSpec.cs

示例13: TestService

            public TestService(IActorRef testActorRef)
            {
                Receive<string>(cmd => cmd.Equals("shutdown"), msg =>
                {
                    Context.System.Terminate();
                });

                ReceiveAny(msg =>
                {
                    testActorRef.Forward(msg);
                    Sender.Tell(new Reply(msg.ToString() + "-ack", Cluster.Get(Context.System).SelfAddress));
                });
            }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:13,代码来源:ClusterClientSpec.cs


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