private void Handle(AddNewProductMsg msg) { Props props = Props.Create <ProductActor>(msg); IActorRef productActor = Context.ActorOf(props, ActorNames.Product(msg.ProductNumber)); productActor.Tell(msg); }
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 }); }
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)); }
public void RemoveItem(int basket, int product) { IActorRef basketManager = ActorSystem.ActorOf <ProductManagementActor>(ActorNames.BasketManager()); basketManager.Tell(new ReturnProductMsg(product, basket)); }