private void SendRemote(CommandJob job, CommandJobTask subtask, StitchSummary stitch)
        {
            var request = CreateRemoteRequest(stitch);

            request.Target = stitch.Id;
            _sender.SendCommandRequest(stitch.NetworkNodeId, request, job, subtask);
        }
Пример #2
0
        private CommandResponse HandleRemote(CommandRequest request, StitchSummary stitch)
        {
            string nodeId = stitch.NodeId;
            var    node   = _data.Get <NodeStatus>(nodeId);

            if (node == null)
            {
                return(CommandResponse.Create(false));
            }

            // Create a job to track status
            var job     = _jobManager.CreateJob("Command=" + request.Command);
            var subtask = job.CreateSubtask(request.Command, request.Target, stitch.NodeId);

            // Create the message and send it over the backplane
            _sender.SendCommandRequest(node.NetworkNodeId, request, job, subtask);

            _jobManager.Save(job);

            return(CommandResponse.Started(job.Id));
        }
Пример #3
0
        public CommandResponse Handle(CommandRequest request)
        {
            string nodeId = request.Target;

            if (nodeId == _nodeId)
            {
                return(CommandResponse.Create(true));
            }
            var node = _data.Get <NodeStatus>(nodeId);

            if (node == null)
            {
                return(CommandResponse.Create(false));
            }

            var job     = _jobManager.CreateJob("Command=Ping");
            var subtask = job.CreateSubtask(request.Command, request.Target, nodeId);

            // Create the message and send it over the backplane
            _sender.SendCommandRequest(node.NetworkNodeId, request, job, subtask);
            _jobManager.Save(job);
            return(CommandResponse.Started(job.Id));
        }