private void SendRemote(CommandJob job, CommandJobTask subtask, StitchSummary stitch) { var request = CreateRemoteRequest(stitch); request.Target = stitch.Id; _sender.SendCommandRequest(stitch.NetworkNodeId, request, job, subtask); }
protected virtual CommandRequest CreateRemoteRequest(StitchSummary stitch) { return(new CommandRequest { Command = CommandType }); }
public void AddRemoteStitch(string nodeId, string networkNodeId, string id, StitchGroupName groupName) { var summary = new StitchSummary { GroupName = groupName, Id = id, Locale = StitchLocaleType.Remote, NodeId = nodeId, NetworkNodeId = networkNodeId }; if (!_remoteStitches.ContainsKey(nodeId)) { _remoteStitches.Add(nodeId, new List <StitchSummary> { summary }); return; } var summaries = _remoteStitches[nodeId] .Where(ss => ss.Id != id) .Concat(new[] { summary }) .ToList(); _remoteStitches[nodeId] = summaries; _allStitches = null; }
protected override void SendLocal(CommandJob job, CommandJobTask subtask, StitchSummary stitch) { // TODO: Publish status async here and rely on the job to communicate status of the // request. We will need a new mechanism for this and new message types bool ok = _stitches.StopInstance(stitch.Id); subtask.Status = ok ? JobStatusType.Success : JobStatusType.Failure; }
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)); }
protected abstract void SendLocal(CommandJob job, CommandJobTask subtask, StitchSummary stitch);