Search in sources :

Example 1 with KafkaSourceRequest

use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest in project incubator-inlong by apache.

the class InlongStreamSourceTransfer method createKafkaSourceRequest.

private static KafkaSourceRequest createKafkaSourceRequest(KafkaSource kafkaSource, InlongStreamInfo streamInfo) {
    KafkaSourceRequest sourceRequest = new KafkaSourceRequest();
    sourceRequest.setSourceName(kafkaSource.getSourceName());
    sourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
    sourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
    sourceRequest.setSourceType(kafkaSource.getSourceType().name());
    sourceRequest.setAgentIp(kafkaSource.getAgentIp());
    sourceRequest.setBootstrapServers(kafkaSource.getBootstrapServers());
    sourceRequest.setTopic(kafkaSource.getTopic());
    sourceRequest.setRecordSpeedLimit(kafkaSource.getRecordSpeedLimit());
    sourceRequest.setByteSpeedLimit(kafkaSource.getByteSpeedLimit());
    sourceRequest.setTopicPartitionOffset(kafkaSource.getTopicPartitionOffset());
    sourceRequest.setAutoOffsetReset(kafkaSource.getAutoOffsetReset().getName());
    sourceRequest.setGroupId(kafkaSource.getConsumerGroup());
    sourceRequest.setSerializationType(kafkaSource.getDataFormat().getName());
    sourceRequest.setDatabasePattern(kafkaSource.getDatabasePattern());
    sourceRequest.setTablePattern(kafkaSource.getTablePattern());
    sourceRequest.setIgnoreParseErrors(kafkaSource.isIgnoreParseErrors());
    sourceRequest.setTimestampFormatStandard(kafkaSource.getTimestampFormatStandard());
    return sourceRequest;
}
Also used : KafkaSourceRequest(org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest)

Example 2 with KafkaSourceRequest

use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest in project incubator-inlong by apache.

the class KafkaStreamSourceOperation method setTargetEntity.

@Override
protected void setTargetEntity(SourceRequest request, StreamSourceEntity targetEntity) {
    KafkaSourceRequest sourceRequest = (KafkaSourceRequest) request;
    CommonBeanUtils.copyProperties(sourceRequest, targetEntity, true);
    try {
        KafkaSourceDTO dto = KafkaSourceDTO.getFromRequest(sourceRequest);
        targetEntity.setExtParams(objectMapper.writeValueAsString(dto));
    } catch (Exception e) {
        throw new BusinessException(ErrorCodeEnum.SOURCE_INFO_INCORRECT.getMessage());
    }
}
Also used : BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException) KafkaSourceRequest(org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest) KafkaSourceDTO(org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceDTO) BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException)

Example 3 with KafkaSourceRequest

use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest in project incubator-inlong by apache.

the class AbstractSourceOperateListener method createSourceRequest.

public SourceRequest createSourceRequest(SourceResponse sourceResponse) {
    String sourceType = sourceResponse.getSourceType();
    SourceType type = SourceType.valueOf(sourceType);
    switch(type) {
        case BINLOG:
            return CommonBeanUtils.copyProperties((BinlogSourceResponse) sourceResponse, BinlogSourceRequest::new);
        case KAFKA:
            return CommonBeanUtils.copyProperties((KafkaSourceResponse) sourceResponse, KafkaSourceRequest::new);
        default:
            throw new IllegalArgumentException(String.format("Unsupported type=%s for DataSourceOperateListener", type));
    }
}
Also used : KafkaSourceRequest(org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest) SourceType(org.apache.inlong.manager.common.enums.SourceType) BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)

Example 4 with KafkaSourceRequest

use of org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest in project incubator-inlong by apache.

the class DisableZkForSortTest method createKafkaSource.

public KafkaSourceRequest createKafkaSource(InlongStreamInfo streamInfo) {
    KafkaSourceRequest kafkaSourceRequest = new KafkaSourceRequest();
    kafkaSourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
    kafkaSourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
    kafkaSourceRequest.setGroupId("default");
    kafkaSourceRequest.setSerializationType("csv");
    kafkaSourceRequest.setSourceName("KAFKA");
    streamSourceService.save(kafkaSourceRequest, OPERATOR);
    return kafkaSourceRequest;
}
Also used : KafkaSourceRequest(org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest)

Aggregations

KafkaSourceRequest (org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest)4 SourceType (org.apache.inlong.manager.common.enums.SourceType)1 BusinessException (org.apache.inlong.manager.common.exceptions.BusinessException)1 BinlogSourceRequest (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)1 KafkaSourceDTO (org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceDTO)1