use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class WorkflowContextBuilderImpl method buildContextForProcess.
@SneakyThrows
@Override
public WorkflowContext buildContextForProcess(String name, String applicant, ProcessForm form) {
WorkflowProcess process = definitionRepository.get(name).clone();
WorkflowContext context = new WorkflowContext();
context.setProcess(process);
context.setProcessForm(form);
context.setApplicant(applicant);
return context;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class DataSourceListenerTest method testFrozenSource.
@Test
public void testFrozenSource() {
groupInfo = initGroupForm("PULSAR");
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
final int sourceId = createBinlogSource(groupInfo);
streamSourceService.updateStatus(groupInfo.getInlongGroupId(), null, SourceState.SOURCE_NORMAL.getCode(), OPERATOR);
form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.SUSPEND);
WorkflowContext context = workflowEngine.processService().start(ProcessName.SUSPEND_GROUP_PROCESS.name(), applicant, form);
WorkflowResult result = WorkflowBeanUtils.result(context);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
WorkflowProcess process = context.getProcess();
WorkflowTask task = process.getTaskByName("stopSource");
Assert.assertTrue(task instanceof ServiceTask);
SourceResponse sourceResponse = streamSourceService.get(sourceId, SourceType.BINLOG.toString());
Assert.assertSame(SourceState.forCode(sourceResponse.getStatus()), SourceState.TO_BE_ISSUED_FROZEN);
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method getBriefFromProcessEntity.
private WorkflowBriefDTO getBriefFromProcessEntity(WorkflowProcessEntity processEntity) {
WorkflowProcess process = definitionRepository.get(processEntity.getName());
if (process == null) {
return null;
}
Map<String, TaskStatus> nameStatusMap = this.getTaskNameStatusMap(processEntity);
ElementDTO elementDTO = new ElementDTO();
StartEvent startEvent = process.getStartEvent();
elementDTO.setName(startEvent.getName());
elementDTO.setDisplayName(startEvent.getDisplayName());
WorkflowContext context = WorkflowBeanUtils.buildContext(process, processEntity);
addNext(startEvent, elementDTO, context, nameStatusMap);
WorkflowBriefDTO briefDTO = new WorkflowBriefDTO();
briefDTO.setName(process.getName());
briefDTO.setDisplayName(process.getDisplayName());
briefDTO.setType(process.getType());
briefDTO.setStartEvent(elementDTO);
return briefDTO;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class ProcessEventNotifier method notify.
@Override
public void notify(String listenerName, boolean forceSync, WorkflowContext sourceContext) {
final WorkflowContext context = sourceContext.clone();
WorkflowProcess process = context.getProcess();
Optional.ofNullable(this.eventListenerManager.listener(listenerName)).ifPresent(logableNotify(forceSync, context));
Optional.ofNullable(process.listener(listenerName)).ifPresent(logableNotify(forceSync, context));
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class ProcessEventNotifier method notify.
@Override
public void notify(ProcessEvent event, WorkflowContext sourceContext) {
final WorkflowContext context = sourceContext.clone();
WorkflowProcess process = context.getProcess();
eventListenerManager.syncListeners(event).forEach(syncLogableNotify(context));
process.syncListeners(event).forEach(syncLogableNotify(context));
eventListenerManager.asyncListeners(event).forEach(asyncLogableNotify(context));
process.asyncListeners(event).forEach(asyncLogableNotify(context));
}
Aggregations