Search in sources :

Example 1 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest 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 2 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class StreamSourceServiceTest method saveSource.

public Integer saveSource() {
    streamServiceTest.saveInlongStream(globalGroupId, globalStreamId, globalOperator);
    BinlogSourceRequest sourceInfo = new BinlogSourceRequest();
    sourceInfo.setInlongGroupId(globalGroupId);
    sourceInfo.setInlongStreamId(globalStreamId);
    sourceInfo.setSourceName(sourceName);
    sourceInfo.setSourceType(Constant.SOURCE_BINLOG);
    return sourceService.save(sourceInfo, globalOperator);
}
Also used : BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)

Example 3 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class DataSourceListenerTest method createBinlogSource.

public Integer createBinlogSource(InlongGroupInfo groupInfo) {
    final InlongStreamInfo streamInfo = createStreamInfo(groupInfo);
    BinlogSourceRequest sourceRequest = new BinlogSourceRequest();
    sourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
    sourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
    sourceRequest.setSourceName("binlog-collect");
    return streamSourceService.save(sourceRequest, OPERATOR);
}
Also used : BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest) InlongStreamInfo(org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)

Example 4 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class BinlogStreamSourceOperation method setTargetEntity.

@Override
protected void setTargetEntity(SourceRequest request, StreamSourceEntity targetEntity) {
    BinlogSourceRequest sourceRequest = (BinlogSourceRequest) request;
    CommonBeanUtils.copyProperties(sourceRequest, targetEntity, true);
    try {
        BinlogSourceDTO dto = BinlogSourceDTO.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) BinlogSourceDTO(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceDTO) BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest) BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException)

Example 5 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class AgentServiceTest method saveSource.

public Integer saveSource() {
    streamServiceTest.saveInlongStream(globalGroupId, globalStreamId, globalOperator);
    BinlogSourceRequest sourceInfo = new BinlogSourceRequest();
    sourceInfo.setInlongGroupId(globalGroupId);
    sourceInfo.setInlongStreamId(globalStreamId);
    sourceInfo.setSourceType(Constant.SOURCE_BINLOG);
    return sourceService.save(sourceInfo, globalOperator);
}
Also used : BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)

Aggregations

BinlogSourceRequest (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)7 DefaultAuthentication (org.apache.inlong.manager.client.api.auth.DefaultAuthentication)1 SourceType (org.apache.inlong.manager.common.enums.SourceType)1 BusinessException (org.apache.inlong.manager.common.exceptions.BusinessException)1 SourceResponse (org.apache.inlong.manager.common.pojo.source.SourceResponse)1 BinlogSourceDTO (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceDTO)1 BinlogSourceResponse (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceResponse)1 KafkaSourceRequest (org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest)1 InlongStreamInfo (org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)1 ServiceBaseTest (org.apache.inlong.manager.service.ServiceBaseTest)1 InlongStreamServiceTest (org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest)1 Test (org.junit.Test)1