Ejemplo n.º 1
0
        public PublisherActor()
        {
            pubsubservice = DistributedPubSubService.For(Context.System);

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

            Receive <ITradeEvent>(Handler);
        }
Ejemplo n.º 2
0
        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}");
            });
        }
Ejemplo n.º 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")}");
            });
        }