use of org.apache.inlong.manager.common.enums.MqType in project incubator-inlong by apache.
the class InlongGroupTransfer method createGroupInfo.
public static InlongGroupInfo createGroupInfo(InlongGroupConf groupConf) {
InlongGroupInfo groupInfo = new InlongGroupInfo();
AssertUtil.hasLength(groupConf.getGroupName(), "GroupName should not be empty");
groupInfo.setName(groupConf.getGroupName());
groupInfo.setCnName(groupConf.getCnName());
groupInfo.setDescription(groupConf.getDescription());
groupInfo.setZookeeperEnabled(groupConf.isZookeeperEnabled() ? 1 : 0);
groupInfo.setDailyRecords(groupConf.getDailyRecords().intValue());
groupInfo.setPeakRecords(groupConf.getPeakRecords().intValue());
groupInfo.setMaxLength(groupConf.getMaxLength());
groupInfo.setProxyClusterId(groupConf.getProxyClusterId());
MqBaseConf mqConf = groupConf.getMqBaseConf();
MqType mqType = MqType.NONE;
if (null != mqConf) {
mqType = mqConf.getType();
groupInfo.setMiddlewareType(mqType.name());
}
groupInfo.setInCharges(groupConf.getOperator());
groupInfo.setExtList(Lists.newArrayList());
groupInfo.setCreator(groupConf.getOperator());
if (mqType == MqType.PULSAR || mqType == MqType.TDMQ_PULSAR) {
PulsarBaseConf pulsarBaseConf = (PulsarBaseConf) mqConf;
groupInfo.setMqResourceObj(pulsarBaseConf.getNamespace());
InlongGroupPulsarInfo pulsarInfo = createPulsarInfo(pulsarBaseConf);
groupInfo.setMqExtInfo(pulsarInfo);
List<InlongGroupExtInfo> extInfos = createPulsarExtInfo(pulsarBaseConf);
groupInfo.getExtList().addAll(extInfos);
groupInfo.setTopicPartitionNum(pulsarBaseConf.getTopicPartitionNum());
} else if (mqType == MqType.TUBE) {
TubeBaseConf tubeBaseConf = (TubeBaseConf) mqConf;
List<InlongGroupExtInfo> extInfos = createTubeExtInfo(tubeBaseConf);
groupInfo.setMqResourceObj(tubeBaseConf.getGroupName());
groupInfo.getExtList().addAll(extInfos);
groupInfo.setTopicPartitionNum(tubeBaseConf.getTopicPartitionNum());
}
SortBaseConf sortBaseConf = groupConf.getSortBaseConf();
SortType sortType = sortBaseConf.getType();
if (sortType == SortType.FLINK) {
FlinkSortBaseConf flinkSortBaseConf = (FlinkSortBaseConf) sortBaseConf;
List<InlongGroupExtInfo> sortExtInfos = createFlinkExtInfo(flinkSortBaseConf);
groupInfo.getExtList().addAll(sortExtInfos);
} else if (sortType == SortType.USER_DEFINED) {
UserDefinedSortConf udf = (UserDefinedSortConf) sortBaseConf;
List<InlongGroupExtInfo> sortExtInfos = createUserDefinedSortExtInfo(udf);
groupInfo.getExtList().addAll(sortExtInfos);
} else {
// todo local
}
return groupInfo;
}
use of org.apache.inlong.manager.common.enums.MqType in project incubator-inlong by apache.
the class InlongGroupTransfer method parseMqBaseConf.
public static MqBaseConf parseMqBaseConf(InlongGroupResponse inlongGroupResponse) {
InlongGroupMqExtBase mqExtBase = inlongGroupResponse.getMqExtInfo();
if (null == mqExtBase || StringUtils.isBlank(mqExtBase.getMiddlewareType())) {
return null;
}
String middleWare = mqExtBase.getMiddlewareType();
MqType mqType = MqType.forType(middleWare);
switch(mqType) {
case NONE:
return MqBaseConf.BLANK_MQ_CONF;
case PULSAR:
case TDMQ_PULSAR:
return parsePulsarConf(inlongGroupResponse);
case TUBE:
return parseTubeConf(inlongGroupResponse);
default:
throw new RuntimeException(String.format("Illegal mqType=%s for Inlong", mqType));
}
}
Aggregations