Ejemplo n.º 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);
        }
Ejemplo n.º 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
            });
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
        public void RemoveItem(int basket, int product)
        {
            IActorRef basketManager = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.BasketManager());

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