public class FileWritingMessageHandlerSpec extends MessageHandlerSpec<FileWritingMessageHandlerSpec,FileWritingMessageHandler> implements ComponentsRegistration
MessageHandlerSpec
for the FileWritingMessageHandler
.PARSER, target
logger
DEFAULT_PHASE
OBJECT_TYPE_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
protected |
FileWritingMessageHandlerSpec(Expression directoryExpression) |
protected |
FileWritingMessageHandlerSpec(File destinationDirectory) |
protected |
FileWritingMessageHandlerSpec(java.util.function.Function<Message<P>,?> directoryFunction) |
protected |
FileWritingMessageHandlerSpec(String directoryExpression) |
Modifier and Type | Method and Description |
---|---|
FileWritingMessageHandlerSpec |
appendNewLine(boolean appendNewLine)
If
true will append a new-line after each write. |
FileWritingMessageHandlerSpec |
autoCreateDirectory(boolean autoCreateDirectory)
Specify whether to create the destination directory automatically if it
does not yet exist upon initialization.
|
FileWritingMessageHandlerSpec |
bufferSize(int bufferSize)
Set the buffer size to use while writing to files; default 8192.
|
FileWritingMessageHandlerSpec |
charset(String charset)
Set the charset to use when converting String payloads to bytes as the content of the file.
|
FileWritingMessageHandlerSpec |
chmod(int chmod)
Set the file permissions after uploading, e.g.
|
FileWritingMessageHandlerSpec |
deleteSourceFiles(boolean deleteSourceFiles)
Specify whether to delete source Files after writing to the destination directory.
|
FileWritingMessageHandlerSpec |
fileExistsMode(FileExistsMode fileExistsMode)
Set the
FileExistsMode that specifies what will happen in
case the destination exists. |
FileWritingMessageHandlerSpec |
fileNameExpression(String fileNameExpression)
Set the
DefaultFileNameGenerator based on the provided SpEL expression. |
FileWritingMessageHandlerSpec |
fileNameGenerator(FileNameGenerator fileNameGenerator)
Set the file name generator used to generate the target file name.
|
FileWritingMessageHandlerSpec |
flushInterval(long flushInterval)
Set the frequency to flush buffers when
FileExistsMode.APPEND_NO_FLUSH is
being used. |
FileWritingMessageHandlerSpec |
flushPredicate(FileWritingMessageHandler.MessageFlushPredicate flushPredicate)
Specify a
FileWritingMessageHandler.MessageFlushPredicate for flush task
when the FileExistsMode.APPEND_NO_FLUSH is in use. |
FileWritingMessageHandlerSpec |
flushWhenIdle(boolean flushWhenIdle)
Set the flush when idle flag to false if you wish the interval to apply to when
the file was opened rather than when the file was last written.
|
Map<Object,String> |
getComponentsToRegister() |
FileWritingMessageHandlerSpec |
preserveTimestamp(boolean preserveTimestamp)
Set to true to preserve the destination file timestamp.
|
FileWritingMessageHandlerSpec |
taskScheduler(TaskScheduler taskScheduler)
Specify a
TaskScheduler for flush task when the FileExistsMode.APPEND_NO_FLUSH is in use. |
FileWritingMessageHandlerSpec |
temporaryFileSuffix(String temporaryFileSuffix)
By default, every file that is in the process of being transferred will
appear in the file system with an additional suffix, which by default is
.writing . |
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
protected FileWritingMessageHandlerSpec(File destinationDirectory)
protected FileWritingMessageHandlerSpec(String directoryExpression)
protected FileWritingMessageHandlerSpec(java.util.function.Function<Message<P>,?> directoryFunction)
protected FileWritingMessageHandlerSpec(Expression directoryExpression)
public FileWritingMessageHandlerSpec autoCreateDirectory(boolean autoCreateDirectory)
autoCreateDirectory
- true to create the directory if needed.public FileWritingMessageHandlerSpec temporaryFileSuffix(String temporaryFileSuffix)
.writing
.temporaryFileSuffix
- The temporary file suffix.public FileWritingMessageHandlerSpec fileExistsMode(FileExistsMode fileExistsMode)
FileExistsMode
that specifies what will happen in
case the destination exists.fileExistsMode
- the FileExistsMode
to consult.public FileWritingMessageHandlerSpec fileNameGenerator(FileNameGenerator fileNameGenerator)
DefaultFileNameGenerator
.fileNameGenerator
- the file name generator.public FileWritingMessageHandlerSpec fileNameExpression(String fileNameExpression)
DefaultFileNameGenerator
based on the provided SpEL expression.fileNameExpression
- the SpEL expression for file names generation.public FileWritingMessageHandlerSpec deleteSourceFiles(boolean deleteSourceFiles)
FileHeaders.ORIGINAL_FILE
header value
containing either a File instance or a String representing the original file path.deleteSourceFiles
- true to delete the source files.public FileWritingMessageHandlerSpec charset(String charset)
UTF-8
.charset
- the charset.public FileWritingMessageHandlerSpec appendNewLine(boolean appendNewLine)
true
will append a new-line after each write.
Defaults to false
.appendNewLine
- true if a new-line should be written to the file after payload is written.FileWritingMessageHandler.setAppendNewLine(boolean)
public FileWritingMessageHandlerSpec bufferSize(int bufferSize)
bufferSize
- the buffer size.FileWritingMessageHandler.setBufferSize(int)
public FileWritingMessageHandlerSpec flushInterval(long flushInterval)
FileExistsMode.APPEND_NO_FLUSH
is
being used.flushInterval
- the interval.FileWritingMessageHandler.setBufferSize(int)
,
flushWhenIdle(boolean)
public FileWritingMessageHandlerSpec flushWhenIdle(boolean flushWhenIdle)
flushWhenIdle
- false to flush if the interval since the file was opened has elapsed.FileWritingMessageHandler.setFlushWhenIdle(boolean)
,
flushInterval(long)
public FileWritingMessageHandlerSpec taskScheduler(TaskScheduler taskScheduler)
TaskScheduler
for flush task when the FileExistsMode.APPEND_NO_FLUSH
is in use.taskScheduler
- the TaskScheduler
to use.IntegrationObjectSupport.setTaskScheduler(TaskScheduler)
public FileWritingMessageHandlerSpec flushPredicate(FileWritingMessageHandler.MessageFlushPredicate flushPredicate)
FileWritingMessageHandler.MessageFlushPredicate
for flush task
when the FileExistsMode.APPEND_NO_FLUSH
is in use.flushPredicate
- the FileWritingMessageHandler.MessageFlushPredicate
to use.FileWritingMessageHandler.setFlushPredicate(FileWritingMessageHandler.MessageFlushPredicate)
public FileWritingMessageHandlerSpec preserveTimestamp(boolean preserveTimestamp)
File
, the payload's lastModified
time will be
transferred to the destination file.preserveTimestamp
- the boolean
flag to use.FileWritingMessageHandler.setPreserveTimestamp(boolean)
public FileWritingMessageHandlerSpec chmod(int chmod)
chmod
- the permissions.IllegalArgumentException
- if the value is higher than 0777.FileWritingMessageHandler.setChmod(int)
public Map<Object,String> getComponentsToRegister()
getComponentsToRegister
in interface ComponentsRegistration