INT-4502: Add new file callback in FileWritingMH

JIRA: https://jira.spring.io/browse/INT-4502

Documentation
Using a BiConsumer instead of a custom interface

Doc fixes

Calling callback while locked

More requested fixes

Missing `FileWritingMessageHandler.this` on `fileExistsMode`
This commit is contained in:
Alen Turkovic
2018-07-23 10:44:21 +02:00
committed by Artem Bilan
parent a7ffbde07f
commit 9ac0746f19
4 changed files with 87 additions and 13 deletions

View File

@@ -616,6 +616,10 @@ outbound gateway by using the XML namespace.
Starting with version 4.3, you can specify the buffer size to use when writing files.
Starting with version 5.1, you can provide a `BiConsumer<File, Message<?>>` `newFileCallback` which will be triggered if you are using `FileExistsMode.APPEND` or `FileExistsMode.APPEND_NO_FLUSH` and a new file has to be created.
This callback receives the newly created file and the message which triggered it.
This callback could be used to write a CSV header defined in the message header, for an example.
[[file-writing-file-names]]
==== Generating File Names

View File

@@ -86,6 +86,13 @@ Starting with version 5.1, you must explicitly turn on the `@Publisher` AOP func
See "`<<publisher-annotation>>`" for more information.
[[x5.1-file-writing-message-handler]]
=== `FileWritingMessageHandler`: New file callback
If you are using `FileExistsMode.APPEND` or `FileExistsMode.APPEND_NO_FLUSH` you can provide a `newFileCallback` that will be called when creating a new file.
This callback receives the newly created file and the message that triggered the callback.
This could be used to write a CSV header, for an example.
[[x5.1-amqp]]
=== AMQP Changes