Exemple #1
0
        public AssignLineActor()
        {
            Receive <string>(message =>
            {
                if (string.Equals(message, startCommand, System.StringComparison.OrdinalIgnoreCase))
                {
                    Line line = _lineService.GetLeastVehiclesLine();
                    if (line != null)
                    {
                        line.VehicleCount         += 1;
                        Props UpdateLineActorProps = Props.Create(() =>
                                                                  new UpdateLineActor(line.Id, _lineService));

                        var updateLineActor = Context.ActorOf(UpdateLineActorProps);

                        updateLineActor.Tell(line);
                        Sender.Tell(line.ExternalId);
                    }

                    Sender.Tell("");
                }
            });
        }