Search in sources :

Example 6 with DefaultAuthentication

use of org.apache.inlong.manager.client.api.auth.DefaultAuthentication in project incubator-inlong by apache.

the class InlongStreamSourceTransfer method parseMySQLBinlogSource.

private static MySQLBinlogSource parseMySQLBinlogSource(BinlogSourceListResponse response) {
    MySQLBinlogSource binlogSource = new MySQLBinlogSource();
    binlogSource.setSourceName(response.getSourceName());
    binlogSource.setHostname(response.getHostname());
    binlogSource.setDataFormat(DataFormat.NONE);
    binlogSource.setPort(response.getPort());
    DefaultAuthentication defaultAuthentication = new DefaultAuthentication(response.getUser(), response.getPassword());
    binlogSource.setAuthentication(defaultAuthentication);
    binlogSource.setIncludeSchema(response.getIncludeSchema());
    binlogSource.setServerTimezone(response.getServerTimezone());
    binlogSource.setMonitoredDdl(response.getMonitoredDdl());
    binlogSource.setTimestampFormatStandard(response.getTimestampFormatStandard());
    binlogSource.setAllMigration(response.isAllMigration());
    if (StringUtils.isNotBlank(response.getDatabaseWhiteList())) {
        binlogSource.setDbNames(Arrays.asList(response.getDatabaseWhiteList().split(",")));
    }
    if (StringUtils.isNotBlank(response.getTableWhiteList())) {
        binlogSource.setTableNames(Arrays.asList(response.getTableWhiteList().split(",")));
    }
    return binlogSource;
}
Also used : DefaultAuthentication(org.apache.inlong.manager.client.api.auth.DefaultAuthentication) MySQLBinlogSource(org.apache.inlong.manager.client.api.source.MySQLBinlogSource)

Example 7 with DefaultAuthentication

use of org.apache.inlong.manager.client.api.auth.DefaultAuthentication in project incubator-inlong by apache.

the class InlongStreamSourceTransfer method createBinlogSourceRequest.

private static BinlogSourceRequest createBinlogSourceRequest(MySQLBinlogSource binlogSource, InlongStreamInfo streamInfo) {
    BinlogSourceRequest sourceRequest = new BinlogSourceRequest();
    sourceRequest.setSourceName(binlogSource.getSourceName());
    sourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
    sourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
    sourceRequest.setSourceType(binlogSource.getSourceType().name());
    sourceRequest.setAgentIp(binlogSource.getAgentIp());
    DefaultAuthentication authentication = binlogSource.getAuthentication();
    sourceRequest.setUser(authentication.getUserName());
    sourceRequest.setPassword(authentication.getPassword());
    sourceRequest.setHostname(binlogSource.getHostname());
    sourceRequest.setPort(binlogSource.getPort());
    sourceRequest.setIncludeSchema(binlogSource.getIncludeSchema());
    sourceRequest.setServerTimezone(binlogSource.getServerTimezone());
    sourceRequest.setMonitoredDdl(binlogSource.getMonitoredDdl());
    sourceRequest.setAllMigration(binlogSource.isAllMigration());
    if (CollectionUtils.isNotEmpty(binlogSource.getDbNames())) {
        String dbNames = Joiner.on(",").join(binlogSource.getDbNames());
        sourceRequest.setDatabaseWhiteList(dbNames);
    }
    if (CollectionUtils.isNotEmpty(binlogSource.getTableNames())) {
        String tableNames = Joiner.on(",").join(binlogSource.getTableNames());
        sourceRequest.setTableWhiteList(tableNames);
    }
    sourceRequest.setSnapshotMode("initial");
    sourceRequest.setIntervalMs("500");
    sourceRequest.setTimestampFormatStandard(binlogSource.getTimestampFormatStandard());
    return sourceRequest;
}
Also used : DefaultAuthentication(org.apache.inlong.manager.client.api.auth.DefaultAuthentication) BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)

Aggregations

DefaultAuthentication (org.apache.inlong.manager.client.api.auth.DefaultAuthentication)7 ClickHouseSink (org.apache.inlong.manager.client.api.sink.ClickHouseSink)2 HiveSink (org.apache.inlong.manager.client.api.sink.HiveSink)2 MySQLBinlogSource (org.apache.inlong.manager.client.api.source.MySQLBinlogSource)2 SinkFieldRequest (org.apache.inlong.manager.common.pojo.sink.SinkFieldRequest)2 ClickHouseSinkRequest (org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkRequest)1 HiveSinkRequest (org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkRequest)1 BinlogSourceRequest (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)1