The default MessageMapper for FileTarget accepts a Message whose payload is one of: File, String, or byte[]. It then just writes the content to the provided directory with the filename as determined by the FileNameGenerator.
It is questionable that this "mapper" as such should be configurable. In fact, we are already considering whether it's better to just have that same behavior built into the target implementation.
That said, extension points are definitely necessary. But, it seems that any customization that needs to be done could be handled by a transformer applied to the Message immediately before being processed by the target. I'm afraid that the current approach provides too many ways to accomplish the same thing, and that leads to confusion in general. If the transformer is sufficient (and more intuitive), then we should remove the MessageMapper - or at least no longer treat it as part of the "public" API.
For the next release, we are working on support for something like the following (exact syntax is subject to change):
Code:
<channel-adapter id="fileOut" target="fileTarget">
<interceptors>
<transform-on-send transformer="filePayloadTransformer"/>
</interceptors>
</channel-adapter>
<file-target id="fileTarget" directory="/tmp/test"/>
What I am interested in is if this extension point would be sufficient for your use-case. In other words, if you forget that you ever saw the MessageMapper, would this be a logical place to add your behavior?
Regards,
Mark