To write messages to the file system you can use a
FileWritingMessageHandler
. This class can deal with File or byte[] payloads and otherwise
invokes the toString() method on the payload to establish the contents
of the File. In its simplest form the
FileWritingMessageHandler
just needs a parent directory for the files.
Additionally, you can configure the encoding and the charset that will be used in case of a fallback on the toString() method.
To make things easier you can configure the FileWritingMessageHandler as part of an outbound channel adapter using the namespace.
<file:outbound-channel-adapter id="filesOut" directory="file:${input.directory.property}"/>
If you have more elaborate requirements to the payload to file
conversion you could extend the FileWritingMessageHandler, but a
much better option is to rely on a
Transformer