Using Apache Storm to Move Data
Also available as:

Storm-HDFS: Trident APIs

The Trident API implements a StateFactory class with an API that resembles the methods from the storm-code API, as shown in the following code sample:

Fields hdfsFields = new Fields("field1", "field2");
FileNameFormat fileNameFormat = new DefaultFileNameFormat()
RecordFormat recordFormat = new DelimitedRecordFormat()
FileRotationPolicy rotationPolicy = new FileSizeRotationPolicy(5.0f, FileSizeRotationPolicy.Units.MB);
HdfsState.Options options = new HdfsState.HdfsFileOptions()
StateFactory factory = new HdfsStateFactory().withOptions(options);
TridentState state = stream.partitionPersist(factory, hdfsFields, new HdfsUpdater(), new Fields());

See the javadoc for the Trident API, included with the storm-hdfs connector, for more information.


Directory and file names changes are limited to a prepackaged file name format based on a timestamp.