Ejemplo n.º 1
0
        private void Handle(TakeProductMsg msg)
        {
#warning  // test if item exists / create one if not

            ActorSelection itemActor = Context.ActorSelection(ActorSelectionPaths.BasketItem(msg.BasketId, msg.ProductId));
            itemActor.Tell(msg);
        }
Ejemplo n.º 2
0
        private void Handle(ReturnProductMsg msg)
        {
            if (ItemCount <= 0)
            {
                throw new ApplicationException("No items.....");
            }

            ItemCount--;

            ActorSelection productmananger = Context.ActorSelection(ActorSelectionPaths.ProductManager());

            productmananger.Tell(msg);

            if (ItemCount == 0)
            {
                Self.Tell(new Shutdown());
            }
        }
Ejemplo n.º 3
0
        private void Handle(TakeProductMsg msg)
        {
            if (stock <= 0)
            {
                Sender.Tell(new ProductOutOfStockMessage());
            }

            stock--;

            ActorSelection basketActor = Context.ActorSelection(ActorSelectionPaths.Basket(msg.BasketId));

            msg.Product = product;
#warning dit zou wel eens in strijd kunnen zijn met de principes dat een bericht immutable is.

            basketActor.Tell(msg);
            Sender.Tell(new ResponseMessage {
                RequestMessage = msg, Response = "Product picked from stock", ResponseObject = product
            });
        }
Ejemplo n.º 4
0
        private void Handle(ReturnProductMsg msg)
        {
            ActorSelection basketMngActor = Context.ActorSelection(ActorSelectionPaths.Basket(msg.BasketId));

            basketMngActor.Tell(msg);
        }
Ejemplo n.º 5
0
        private void Handle(ReturnProductMsg msg)
        {
            ActorSelection productActor = Context.ActorSelection(ActorSelectionPaths.Product(msg.ProductId));

            productActor.Tell(msg);
        }
Ejemplo n.º 6
0
        private void Handle(TakeProductMsg msg)
        {
            ActorSelection basketMngActor = Context.ActorSelection(ActorSelectionPaths.Product(msg.ProductId));

            basketMngActor.Tell(msg);
        }
Ejemplo n.º 7
0
        private void Handle(ReturnProductMsg msg)
        {
            ActorSelection itemActor = Context.ActorSelection(ActorSelectionPaths.BasketItem(msg.BasketId, msg.ProductId));

            itemActor.Tell(msg);
        }