private void addExecutionMessageInner(ExecutionMessage msg) { SimpleExecutionRunnable simpleExecutionRunnable = simpleExecutionRunnableFactory.getObject(); simpleExecutionRunnable.setExecutionMessage(msg); Long executionId = null; if (!StringUtils.isEmpty(msg.getMsgId())) { executionId = Long.valueOf(msg.getMsgId()); } workerManager.addExecution(executionId, simpleExecutionRunnable); }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { ExecutionMessage msg = stateMessages.get(i); ps.setLong(1, msg.getExecStateId()); ps.setString(2, msg.getMsgId()); ps.setBytes(3, msg.getPayload().getData()); }
private void deleteExecutionStateObjects(List<ExecutionMessage> messages) { for (ExecutionMessage executionMessage : messages) { if (!failedBecauseNoWorker(extractExecution(executionMessage))) { executionStateService.deleteExecutionState(Long.valueOf(executionMessage.getMsgId()), ExecutionSummary.EMPTY_BRANCH); } } }
private ScoreEvent[] handleTerminatedMessages(List<ExecutionMessage> messages) { List<ScoreEvent> scoreEvents = new ArrayList<>(messages.size()); List<Execution> branches = new ArrayList<>(); for (ExecutionMessage executionMessage : messages) { Execution execution = extractExecution(executionMessage); Boolean isBranch = isBranch(execution); if (!isBranch) { scoreEvents.add(scoreEventFactory.createFinishedEvent(execution)); executionStateService.deleteExecutionState(Long.valueOf(executionMessage.getMsgId()), ExecutionSummary.EMPTY_BRANCH); } else { branches.add(execution); scoreEvents.add(scoreEventFactory.createFinishedBranchEvent(execution)); } } if (CollectionUtils.isNotEmpty(branches)) { splitJoinService.endBranch(branches); } return scoreEvents.toArray(new ScoreEvent[scoreEvents.size()]); }
@Override public void run() { String executionId = executionMessage.getMsgId();
private ExecutionMessage createPendingExecutionMessage(Execution nextStepExecution) { //take care of worker group String groupName = nextStepExecution.getGroupName(); if (groupName == null) { groupName = WorkerNode.DEFAULT_WORKER_GROUPS[0]; } return new ExecutionMessage(ExecutionMessage.EMPTY_EXEC_STATE_ID, ExecutionMessage.EMPTY_WORKER, groupName, executionMessage.getMsgId(), ExecStatus.PENDING, converter.createPayload(nextStepExecution), 0).setWorkerKey(executionMessage.getWorkerKey()); }
private ExecutionMessage createInProgressExecutionMessage(Execution nextStepExecution) { //take care of worker group String groupName = nextStepExecution.getGroupName(); if (groupName == null) { groupName = WorkerNode.DEFAULT_WORKER_GROUPS[0]; } Long id = queueStateIdGeneratorService.generateStateId(); // stay in the same worker in the next step return new ExecutionMessage(id, executionMessage.getWorkerId(), groupName, executionMessage.getMsgId(), ExecStatus.IN_PROGRESS, nextStepExecution, converter.createPayload(nextStepExecution), 0).setWorkerKey(executionMessage.getWorkerKey()); }
private void ackMessages(List<ExecutionMessage> newMessages) throws InterruptedException { ExecutionMessage cloned; for (ExecutionMessage message : newMessages) { // create a unique id for this lane in this specific worker to be used in out buffer optimization //logger.error("ACK FOR MESSAGE: " + message.getMsgId() + " : " + message.getExecStateId()); message.setWorkerKey(message.getMsgId() + " : " + message.getExecStateId()); cloned = (ExecutionMessage) message.clone(); cloned.setStatus(ExecStatus.IN_PROGRESS); cloned.incMsgSeqId(); message.incMsgSeqId(); // increment the original message seq too in order to preserve the order of all messages of entire step cloned.setPayload(null); //payload is not needed in ack - make it null in order to minimize the data that is being sent outBuffer.put(cloned); } }