public class DefaultFileNameFormat extends Object implements 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”.
| Constructor and Description |
|---|
DefaultFileNameFormat() |
| Modifier and Type | Method and Description |
|---|---|
String |
getName(long rotation,
long timeStamp)
Returns the filename the HdfsBolt will create.
|
String |
getPath() |
void |
prepare(Map<String,Object> conf,
TopologyContext topologyContext) |
DefaultFileNameFormat |
withExtension(String extension)
Overrides the default file extension.
|
DefaultFileNameFormat |
withPath(String path) |
DefaultFileNameFormat |
withPrefix(String prefix)
Overrides the default prefix.
|
public DefaultFileNameFormat withPrefix(String prefix)
Overrides the default prefix.
public DefaultFileNameFormat withExtension(String extension)
Overrides the default file extension.
public DefaultFileNameFormat withPath(String path)
public void prepare(Map<String,Object> conf, TopologyContext topologyContext)
prepare in interface FileNameFormatpublic String getName(long rotation, long timeStamp)
FileNameFormatReturns the filename the HdfsBolt will create.
getName in interface FileNameFormatrotation - the current file rotation number (incremented on every rotation)timeStamp - current time in milliseconds when the rotation occurspublic String getPath()
getPath in interface FileNameFormatCopyright © 2021 The Apache Software Foundation. All rights reserved.