use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceListResponse in project incubator-inlong by apache.
the class InlongParser method parseSourceList.
public static PageInfo<SourceListResponse> parseSourceList(Response response) {
Object data = response.getData();
String pageInfoJson = GsonUtil.toJson(data);
PageInfo<SourceListResponse> pageInfo = GsonUtil.fromJson(pageInfoJson, new TypeToken<PageInfo<SourceListResponse>>() {
}.getType());
if (pageInfo.getList() != null && !pageInfo.getList().isEmpty()) {
SourceListResponse sourceListResponse = pageInfo.getList().get(0);
SourceType sourceType = SourceType.forType(sourceListResponse.getSourceType());
if (sourceType == BINLOG) {
return GsonUtil.fromJson(pageInfoJson, new TypeToken<PageInfo<BinlogSourceListResponse>>() {
}.getType());
}
if (sourceType == KAFKA) {
return GsonUtil.fromJson(pageInfoJson, new TypeToken<PageInfo<KafkaSourceListResponse>>() {
}.getType());
}
throw new IllegalArgumentException(String.format("Unsupported sourceType=%s for Inlong", sourceType));
} else {
return new PageInfo<>();
}
}
use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceListResponse in project incubator-inlong by apache.
the class InlongStreamSourceTransfer method parseStreamSource.
public static StreamSource parseStreamSource(SourceListResponse sourceListResponse) {
String type = sourceListResponse.getSourceType();
SourceType sourceType = SourceType.forType(type);
if (sourceType == SourceType.KAFKA && sourceListResponse instanceof KafkaSourceListResponse) {
return parseKafkaSource((KafkaSourceListResponse) sourceListResponse);
}
if (sourceType == SourceType.BINLOG && sourceListResponse instanceof BinlogSourceListResponse) {
return parseMySQLBinlogSource((BinlogSourceListResponse) sourceListResponse);
}
throw new IllegalArgumentException(String.format("Unsupported source type : %s for Inlong", sourceType));
}
Aggregations