public HbaseSink(SinkContext context, HbaseConfig config) throws Exception { { this.config = config; schema = context.getSchema(); tableName = context.getSinkTable(); if (config.nameSpace != null) { tableName = config.nameSpace + ":" + tableName; } hbaseHelper = new HbaseHelper(tableName, config.zookeeper, config.zkNodeParent); if (!hbaseHelper.tableExist(tableName)) { throw new TableNotFoundException("table does not exist, table name " + tableName); } columMapping = ColumUtil.mapping(schema, config.columnMapping); if (!Strings.isNullOrEmpty(config.rowkey)) { int fieldIndex = schema.getFieldIndex(config.rowkey); checkState(fieldIndex != -1, config.rowkey + " does not exist, only " + schema.getFields()); this.rowkeyIndex = fieldIndex; } checkState(rowkeyIndex != -1, "`rowkey` must be set"); hbaseHelper.closeConnection(); } }
public Elasticsearch5Sink(SinkContext context, ElasticsearchSinkConfig config) { schema = context.getSchema(); this.config = config; if (!Strings.isNullOrEmpty(config.idField)) { int fieldIndex = schema.getFieldIndex(config.idField); checkState(fieldIndex != -1, config.idField + " does not exist, only " + schema.getFields()); this.idIndex = fieldIndex; } if (config.update) { checkState(idIndex != -1, "This is Update mode, `id_field` must be set"); } }
public Elasticsearch6Sink(SinkContext context, ElasticsearchSinkConfig config) { schema = context.getSchema(); this.config = config; if (!Strings.isNullOrEmpty(config.idField)) { int fieldIndex = schema.getFieldIndex(config.idField); checkState(fieldIndex != -1, config.idField + " does not exist, only " + schema.getFields()); this.idIndex = fieldIndex; } if (config.update) { checkState(idIndex != -1, "This is Update mode, `id_field` must be set"); } }
public KafkaSink09(SinkContext context, Kafka09SinkConfig config) { schema = context.getSchema(); if (!Strings.isNullOrEmpty(config.idField)) { int fieldIndex = schema.getFieldIndex(config.idField); checkState(fieldIndex != -1, config.idField + " does not exist, only " + schema.getFields()); this.idIndex = fieldIndex; } this.config = config; this.topic = config.topics; }