INT-832: Add File Relative Path to Message Headers

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

When we scan directory recursively for files (e.g. `WatchServiceDirectoryScanner`), it can be useful to get access to the relative path from the `Message`, e.g. on the `FileWritingMessageHandler` side to restore the original structure

* Add a `FileHeaders.FILENAME` into the outbound `Message` from the `FileReadingMessageSource`
* The result of that header is like a removal of leading `this.directory.getAbsolutePath()` in the target `File.getAbsolutePath()`.
In case of not recursion we get just only regular file name.

* Introduce `FileHeaders.RELATIVE_PATH`
* Populated `FileHeaders.RELATIVE_PATH`, `FileHeaders.FILENAME`, `FileHeaders.ORIGINAL_FILE` in the `FileReadingMessageSource`
* File `FileTailingMessageProducerSupport` to populate `FileHeaders` properly
* Introduce ctor for the `LastModifiedFileListFilter` for better Java configuration experience
* Add docs for changes

Doc Polishing
This commit is contained in:
Artem Bilan
2016-09-20 15:09:36 -04:00
committed by Gary Russell
parent 7d9c65a108
commit 8f0fa3468f
12 changed files with 108 additions and 19 deletions

View File

@@ -78,7 +78,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests {
}
int counter = 0;
for (int i = 0; i < numToTest; i++) {
Message<?> message = channel.receive(5000);
Message<?> message = channel.receive(10000);
if (message == null) {
throw new RuntimeException("Failed to receive message # " + i + " iteration " + iteration);
}
@@ -96,7 +96,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests {
adapter.afterPropertiesSet();
adapter.start();
RedisTemplate<?, ?> template = new RedisTemplate<Object, Object>();
RedisTemplate<?, ?> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
template.setEnableDefaultSerializer(false);
template.afterPropertiesSet();
@@ -111,7 +111,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests {
counter = 0;
for (int i = 0; i < numToTest; i++) {
Message<?> message = channel.receive(5000);
Message<?> message = channel.receive(10000);
if (message == null) {
throw new RuntimeException("Failed to receive message # " + i + " iteration " + iteration);
}