Exemplo n.º 1
0
        /// <summary>
        /// TODO: ResourceType usage is not the best solution, and Resource Type might not be required.
        /// </summary>
        /// <param name="discriminator"></param>
        private void RequestAgent(string discriminator)
        {
            FResourceType type = FResourceType.Hub;
            // find the related Hub/Storage Agent
            var agentToProvide = hubManager.GetHubActorRefBy(discriminator);

            if (agentToProvide == null)
            {
                type           = FResourceType.Storage;
                agentToProvide = storageManager.GetHubActorRefBy(discriminator);
            }

            if (agentToProvide == null)
            {
                throw new Exception("no Resource found!");
            }

            var hubInfo = new FAgentInformation(fromType: type
                                                , requiredFor: discriminator
                                                , @ref: agentToProvide);

            // Tell the Requester the corresponding Agent
            Agent.Send(instruction: BasicInstruction.ResponseFromDirectory
                       .Create(message: hubInfo, target: Agent.Sender));
        }
        internal void ResponseFromDirectory(FAgentInformation hubInfo)
        {
            Agent.DebugMessage(msg: "Acquired stock Agent: " + hubInfo.Ref.Path.Name + " from " + Agent.Sender.Path.Name);

            _fArticle = _fArticle.UpdateStorageAgent(s: hubInfo.Ref);
            // Create Request to Storage Agent
            Agent.Send(instruction: Storage.Instruction.RequestArticle.Create(message: _fArticle, target: hubInfo.Ref));
        }
Exemplo n.º 3
0
        private void SetHubAgent(FAgentInformation hub)
        {
            // Enqueue my Element at Hub Agent
            Agent.DebugMessage(msg: $"Received Agent from Directory: {Agent.Sender.Path.Name}");

            // add agent to current Scope.
            _hubAgents.Add(key: hub.Ref, value: hub.RequiredFor);
            // foreach fitting operation
            foreach (var operation in OperationManager.GetOperationBySkill(hub.RequiredFor))
            {
                operation.UpdateHubAgent(hub.Ref);
                Agent.Send(instruction: Hub.Instruction.EnqueueJob.Create(message: operation, target: hub.Ref));
            }
        }
        private void RequestAgent(string discriminator)
        {
            Agent.DebugMessage(msg: $" got called for Agent by:  {Agent.Sender.Path.Name} for: {discriminator}");

            // find the related Hub/Storage Agent
            var agentToProvide = fRequestResources.First(predicate: x => x.Discriminator == discriminator);

            var hubInfo = new FAgentInformation(fromType: agentToProvide.ResourceType
                                                , requiredFor: discriminator
                                                , @ref: agentToProvide.actorRef);

            // Tell the Requester the corresponding Agent
            Agent.Send(instruction: BasicInstruction.ResponseFromDirectory
                       .Create(message: hubInfo, target: Agent.Sender));
        }
 public static SetHubAgent Create(FAgentInformation message, IActorRef target)
 {
     return(new SetHubAgent(message: message, target: target));
 }
Exemplo n.º 6
0
 private void RecoverFromBreak(FAgentInformation item)
 {
     Collector.messageHub.SendToClient(listener: item.RequiredFor + "_State", msg: "online");
 }