Class DefaultFileNameFormat
java.lang.Object
org.apache.storm.hdfs.bolt.format.DefaultFileNameFormat
- All Implemented Interfaces:
Serializable
,FileNameFormat
Creates file names with the following format:
{prefix}{componentId}-{taskId}-{rotationNum}-{timestamp}{extension}For example:
MyBolt-5-7-1390579837830.txt
By default, prefix is empty and extenstion is ".txt".
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName
(long rotation, long timeStamp) Returns the filename the HdfsBolt will create.getPath()
void
prepare
(Map<String, Object> conf, TopologyContext topologyContext) withExtension
(String extension) Overrides the default file extension.withPrefix
(String prefix) Overrides the default prefix.
-
Constructor Details
-
DefaultFileNameFormat
public DefaultFileNameFormat()
-
-
Method Details
-
withPrefix
Overrides the default prefix. -
withExtension
Overrides the default file extension. -
withPath
-
prepare
- Specified by:
prepare
in interfaceFileNameFormat
-
getName
Description copied from interface:FileNameFormat
Returns the filename the HdfsBolt will create.- Specified by:
getName
in interfaceFileNameFormat
- Parameters:
rotation
- the current file rotation number (incremented on every rotation)timeStamp
- current time in milliseconds when the rotation occurs
-
getPath
- Specified by:
getPath
in interfaceFileNameFormat
-