Search in sources :

Example 1 with RecordFormat

use of org.apache.storm.hdfs.trident.format.RecordFormat in project storm by apache.

the class HdfsStateTest method createHdfsState.

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, String> conf = new HashMap<>();
    conf.put(Config.TOPOLOGY_NAME, TEST_TOPOLOGY_NAME);
    HdfsState state = new HdfsState(options);
    state.prepare(conf, null, 0, 1);
    return state;
}
Also used : Fields(org.apache.storm.tuple.Fields) DelimitedRecordFormat(org.apache.storm.hdfs.trident.format.DelimitedRecordFormat) HashMap(java.util.HashMap) DelimitedRecordFormat(org.apache.storm.hdfs.trident.format.DelimitedRecordFormat) RecordFormat(org.apache.storm.hdfs.trident.format.RecordFormat) FileRotationPolicy(org.apache.storm.hdfs.trident.rotation.FileRotationPolicy) FileSizeRotationPolicy(org.apache.storm.hdfs.trident.rotation.FileSizeRotationPolicy)

Aggregations

HashMap (java.util.HashMap)1 DelimitedRecordFormat (org.apache.storm.hdfs.trident.format.DelimitedRecordFormat)1 RecordFormat (org.apache.storm.hdfs.trident.format.RecordFormat)1 FileRotationPolicy (org.apache.storm.hdfs.trident.rotation.FileRotationPolicy)1 FileSizeRotationPolicy (org.apache.storm.hdfs.trident.rotation.FileSizeRotationPolicy)1 Fields (org.apache.storm.tuple.Fields)1