private void EnqueueJob(FOperation fOperation) { var localItem = _operationList.FirstOrDefault(x => x.Key == fOperation.Key); // If item is not Already in Queue Add item to Queue // // happens i.e. Machine calls to Requeue item. if (localItem == null) { localItem = fOperation; localItem.UpdateHubAgent(hub: Agent.Context.Self); _operationList.Add(item: localItem); Agent.DebugMessage(msg: $"Got New Item to Enqueue: {fOperation.Operation.Name} | with start condition: {fOperation.StartConditions.Satisfied} with Id: {fOperation.Key}"); } else { // reset Item. Agent.DebugMessage(msg: $"Got Item to Requeue: {fOperation.Operation.Name} | with start condition: {fOperation.StartConditions.Satisfied} with Id: {fOperation.Key}"); fOperation.Proposals.Clear(); localItem = fOperation; //localItem = fOperation.UpdateHubAgent(hub: Agent.Context.Self); _operationList.Replace(val: localItem); } var resourceToRequest = _resourceManager.GetResourceByTool(fOperation.Operation.ResourceTool); foreach (var actorRef in resourceToRequest) { Agent.DebugMessage(msg: $"Ask for proposal at resource {actorRef.Path.Name}"); Agent.Send(instruction: Resource.Instruction.RequestProposal.Create(message: localItem, target: actorRef)); } }
private void EnqueueJob(FOperation fOperation) { var localItem = _operationList.FirstOrDefault(x => x.Key == fOperation.Key); // If item is not Already in Queue Add item to Queue // // happens i.e. Machine calls to Requeue item. if (localItem == null) { localItem = fOperation; localItem.UpdateHubAgent(hub: Agent.Context.Self); _operationList.Add(item: localItem); Agent.DebugMessage(msg: "Got New Item to Enqueue: " + fOperation.Operation.Name + " | with start condition:" + fOperation.StartConditions.Satisfied + " with Id: " + fOperation.Key); } else { // reset Item. Agent.DebugMessage(msg: "Got Item to Requeue: " + fOperation.Operation.Name + " | with start condition:" + fOperation.StartConditions.Satisfied + " with Id: " + fOperation.Key); fOperation.Proposals.Clear(); localItem = fOperation; //localItem = fOperation.UpdateHubAgent(hub: Agent.Context.Self); _operationList.Replace(val: localItem); } foreach (var actorRef in _resourceAgents) { Agent.Send(instruction: Resource.Instruction.RequestProposal.Create(message: localItem, target: actorRef.Key)); } }