@Override public State makeState(Map<String, Object> conf, IMetricsContext metrics, int partitionIndex, int numPartitions) { LOG.info("makeState(partitonIndex={}, numpartitions={}", partitionIndex, numPartitions); HdfsState state = new HdfsState(this.options); state.prepare(conf, metrics, partitionIndex, numPartitions); return state; } }
private HdfsState createHdfsState() { Fields hdfsFields = new Fields("f1"); RecordFormat recordFormat = new DelimitedRecordFormat().withFields(hdfsFields); FileRotationPolicy rotationPolicy = new FileSizeRotationPolicy(5.0f, FileSizeRotationPolicy.Units.MB); HdfsState.Options options = new HdfsState.HdfsFileOptions() .withFileNameFormat(fileNameFormat) .withRecordFormat(recordFormat) .withRotationPolicy(rotationPolicy) .withFsUrl("file://" + TEST_OUT_DIR); Map<String, Object> conf = new HashMap<>(); conf.put(Config.TOPOLOGY_NAME, TEST_TOPOLOGY_NAME); HdfsState state = new HdfsState(options); state.prepare(conf, null, 0, 1); return state; }
@Override public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) { LOG.info("makeState(partitonIndex={}, numpartitions={}", partitionIndex, numPartitions); HdfsState state = new HdfsState(this.options); state.prepare(conf, metrics, partitionIndex, numPartitions); return state; } }
@Override public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) { LOG.info("makeState(partitonIndex={}, numpartitions={}", partitionIndex, numPartitions); HdfsState state = new HdfsState(this.options); state.prepare(conf, metrics, partitionIndex, numPartitions); return state; } }