Exemple #1
0
        public PublisherActor()
        {
            pubsubservice = DistributedPubSubService.For(Context.System);

            this.Receive <PubSubShardMessage.Ping>(Handle);

            Receive <ITradeEvent>(Handler);
        }
        public SubscriberActor()
        {
            pubSubServicemediator = DistributedPubSubService.For(Context.System);

            Receive <SubscribeAck>(_ => Handle(_));

            Receive <Ping>(_ => Handle(_));

            Receive <ITradeEvent>(p => {
                Console.WriteLine($"Group:{groupname}收到事件:{p.Body}--{this.Sender.Path}");
            });
        }
Exemple #3
0
        public SubscriberManagerActor(string groupname)
        {
            this.groupname = groupname;

            //this.subscriptionManager = MarketEventSubscription.For(Context.System);

            //this.subscriptionManager.Subscribe("fzf007", Self,this.groupname);
            this.distributedPubSub = DistributedPubSubService.For(Context.System);

            distributedPubSub.Subscribe("fzf007", Self, this.groupname);
            Receive <SubscribeAck>(p =>
            {
                Console.WriteLine("Path:{0}", p.Subscribe);
            });

            Receive <ITradeEvent>(p => {
                //Console.WriteLine(Sender.Path);
                Console.WriteLine($"GroupName:{this.groupname}{this.Self.Path}--{p.Body}");
                // Sender.Tell($"Repy:{Guid.NewGuid().ToString("N")}");
            });
        }