use of com.alibaba.otter.canal.client.adapter.tablestore.service.TablestoreEtlService in project canal by alibaba.
the class TablestoreAdapter method etl.
@Override
public EtlResult etl(String task, List<String> params) {
EtlResult etlResult = new EtlResult();
MappingConfig config = tablestoreMapping.get(task);
if (config == null) {
etlResult.setErrorMessage("can not find config for " + task);
etlResult.setSucceeded(false);
return etlResult;
}
TableStoreWriter writer = null;
try {
writer = buildEtlWriter(configuration, config);
TablestoreEtlService rdbEtlService = new TablestoreEtlService(writer, config);
rdbEtlService.importData(params);
etlResult.setSucceeded(true);
return etlResult;
} catch (Exception e) {
logger.error("Error while etl for task " + task, e);
etlResult.setSucceeded(false);
etlResult.setErrorMessage(e.getMessage());
return etlResult;
} finally {
if (writer != null) {
writer.close();
}
}
}
Aggregations