use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class CreateSortConfigListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws Exception {
LOGGER.info("Create sort config for context={}", context);
ProcessForm form = context.getProcessForm();
if (form instanceof UpdateGroupProcessForm) {
UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) form;
OperateType operateType = updateGroupProcessForm.getOperateType();
if (operateType == OperateType.SUSPEND || operateType == OperateType.DELETE) {
return ListenerResult.success();
}
}
InlongGroupInfo groupInfo = this.getGroupInfo(form);
String groupId = groupInfo.getInlongGroupId();
if (StringUtils.isEmpty(groupId)) {
LOGGER.warn("GroupId is null for context={}", context);
return ListenerResult.success();
}
List<SinkResponse> sinkResponseList = streamSinkService.listSink(groupId, null);
if (CollectionUtils.isEmpty(sinkResponseList)) {
LOGGER.warn("Sink not found by groupId={}", groupId);
return ListenerResult.success();
}
Map<String, DataFlowInfo> dataFlowInfoMap = sinkResponseList.stream().map(sink -> {
DataFlowInfo flowInfo = commonOperateService.createDataFlow(groupInfo, sink);
return Pair.of(sink.getInlongStreamId(), flowInfo);
}).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
String dataFlows = OBJECT_MAPPER.writeValueAsString(dataFlowInfoMap);
InlongGroupExtInfo extInfo = new InlongGroupExtInfo();
extInfo.setInlongGroupId(groupId);
extInfo.setKeyName(InlongGroupSettings.DATA_FLOW);
extInfo.setKeyValue(dataFlows);
if (groupInfo.getExtList() == null) {
groupInfo.setExtList(Lists.newArrayList());
}
upsertDataFlow(groupInfo, extInfo);
return ListenerResult.success();
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class ZkDisabledEventSelector method accept.
@Override
public boolean accept(WorkflowContext context) {
ProcessForm processForm = context.getProcessForm();
if (processForm instanceof GroupResourceProcessForm) {
GroupResourceProcessForm groupResourceForm = (GroupResourceProcessForm) processForm;
InlongGroupInfo groupInfo = groupResourceForm.getGroupInfo();
return groupInfo.getZookeeperEnabled() == 0 && !groupInfo.getMiddlewareType().equals(Constant.MIDDLEWARE_NONE);
} else if (processForm instanceof UpdateGroupProcessForm) {
UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) processForm;
InlongGroupInfo groupInfo = updateGroupProcessForm.getGroupInfo();
return groupInfo.getZookeeperEnabled() == 0 && !groupInfo.getMiddlewareType().equals(Constant.MIDDLEWARE_NONE);
} else {
return false;
}
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class ZkEnabledEventSelector method accept.
@Override
public boolean accept(WorkflowContext context) {
ProcessForm processForm = context.getProcessForm();
if (!(processForm instanceof GroupResourceProcessForm)) {
return false;
}
GroupResourceProcessForm groupResourceForm = (GroupResourceProcessForm) processForm;
InlongGroupInfo groupInfo = groupResourceForm.getGroupInfo();
return groupInfo.getZookeeperEnabled() == 1 && !groupInfo.getMiddlewareType().equals(Constant.MIDDLEWARE_NONE);
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class InlongGroupProcessOperationTest method testRestartProcess.
@Test
public void testRestartProcess() {
testSuspendProcess();
WorkflowResult result = groupProcessOperation.restartProcess(GROUP_ID, OPERATOR);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
InlongGroupInfo groupInfo = groupService.get(GROUP_ID);
Assert.assertEquals(groupInfo.getStatus(), EntityStatus.GROUP_RESTART.getCode());
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class InlongGroupServiceTest method saveGroup.
/**
* Test to save group
*/
public String saveGroup(String groupName, String operator) {
InlongGroupInfo groupInfo;
try {
groupInfo = groupService.get(globalGroupId);
if (groupInfo != null) {
return groupInfo.getInlongGroupId();
}
} catch (Exception e) {
// ignore
}
groupInfo = new InlongGroupInfo();
groupInfo.setName(groupName);
groupInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
groupInfo.setCreator(operator);
groupInfo.setInCharges(operator);
groupInfo.setStatus(EntityStatus.GROUP_CONFIG_SUCCESSFUL.getCode());
InlongGroupPulsarInfo pulsarInfo = new InlongGroupPulsarInfo();
pulsarInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
pulsarInfo.setEnsemble(3);
pulsarInfo.setWriteQuorum(3);
pulsarInfo.setAckQuorum(2);
groupInfo.setMqExtInfo(pulsarInfo);
return groupService.save(groupInfo.genRequest(), operator);
}
Aggregations