void IGroupStartContext.StopGroup(string reason) { StopFlag = true; if (CurrentSubscriber != null) { Logger.Info($"{CurrentSubscriber.GetType()} requested group stop"); } var stopGroupMessage = new GroupMessage(GroupActions.Stop, _groupEntity, null, reason); _bus.HandleWatchDogMessage(stopGroupMessage); }
//public void Handle(GroupMessage message) //{ // if (GroupActions.Start.Id ==message.Action.Id) // { // if (message.IsProcessSubmission) // { // CreateProcesses(message.Group, message.ProcessKeys, message.Criteria); // } // else // { // CreateGroup(message.Group, message.Criteria); // } // } // else if(GroupActions.Stop.Id == message.Action.Id) // { // StopGroup(message.Group, message.Message); // } //} public SubmittedGroup HandleStartMessage(GroupMessage message) { if (GroupActions.Start == message.Action) { var groupEntity = _stateManager.GetGroupEntity(message.GroupId); if (groupEntity.IsGenerated) { _logger.Warn("Group {groupId} already generated", message.GroupId); return(null); } //message.Group = groupEntity; List <int> groupProcesses; if (!message.IsProcessSubmission) { if (message.Group.GroupKey == 0) { _logger.Error("Group {groupId} submitted with no group key", message.GroupId); return(null); } groupProcesses = GetGroupProcesses(message.Group.GroupKey); //} //else //{ // return CreateGroup(message.Group, message.Criteria); //} } else { groupProcesses = message.ProcessKeys; } return(CreateProcesses(message.Group, groupProcesses, message.Criteria)); } return(null); //todo not a group start message }