public ProductActor(IProductsDataSource productsDataSource) { _products = productsDataSource.GetAll().ToDictionary(key => key.Id, value => value); Receive <GetProduct>(message => Sender.Tell(GetProduct(message))); Receive <GetAllProducts>(message => Sender.Tell(new AllProducts(message.CorrelationId, _products.Values))); Receive <TakeProductFromStock>(message => Sender.Tell(TakeProductFromStock(message))); Receive <PutProductInStock>(message => Sender.Tell(PutProductInStock(message))); }
public ProductsValuesController(IProductsDataSource productsDataSource) { AdapterProducts = productsDataSource; //todo: // - pozostale metody // - obsluga bledow // - testy // - UI }
public ProductActorProvider(IActorRefFactory system, IProductsDataSource productsDataSource) { _productActorRef = system.ActorOf(ProductActor.Props(productsDataSource), "products"); }
public static Props Props(IProductsDataSource productsDataSource) => Akka.Actor.Props.Create(() => new ProductActor(productsDataSource));