コード例 #1
0
        private void Handle(AddNewProductMsg msg)
        {
            Props     props        = Props.Create <ProductActor>(msg);
            IActorRef productActor = Context.ActorOf(props, ActorNames.Product(msg.ProductNumber));

            productActor.Tell(msg);
        }
コード例 #2
0
        public Product AddItem(int basket, int product)
        {
            IActorRef basketManager = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.BasketManager());

            basketManager.Tell(new TakeProductMsg(product, basket));
            return(new Product {
                ProductNumber = product
            });
        }
コード例 #3
0
        public TanpActorSystem()
        {
            ActorSystem = ActorSystem.Create("TANP");

            // initialize structure
            IActorRef productManager = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.ProductManager());
            IActorRef basketManager  = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.BasketManager());

            // populate with hard coded test feed
            TestDataFeed.GetProducts().ForEach(m => productManager.Tell(m));
        }
コード例 #4
0
        public void RemoveItem(int basket, int product)
        {
            IActorRef basketManager = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.BasketManager());

            basketManager.Tell(new ReturnProductMsg(product, basket));
        }