This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 333b328bcc093ec4a138e41f23b69c7495eb3b2a
Author: Jan Bednář <m...@janbednar.eu>
AuthorDate: Wed Jul 10 19:17:37 2019 +0200

    CAMEL-13628: Code review
---
 .../src/main/docs/file-watch-component.adoc        | 16 +++-
 .../component/file/watch/FileWatchComponent.java   | 86 ++++++++++++++++++++--
 .../component/file/watch/FileWatchConsumer.java    |  4 +-
 .../component/file/watch/FileWatchEndpoint.java    | 20 +++--
 .../file/watch/FileWatchComponentTest.java         |  2 -
 .../file/watch/SpringFileWatcherTest.java          |  6 ++
 docs/components/modules/ROOT/nav.adoc              |  1 +
 .../modules/ROOT/pages/file-watch-component.adoc   | 16 +++-
 .../FileWatchComponentConfiguration.java           | 71 ++++++++++++++++++
 9 files changed, 197 insertions(+), 25 deletions(-)

diff --git 
a/components/camel-file-watch/src/main/docs/file-watch-component.adoc 
b/components/camel-file-watch/src/main/docs/file-watch-component.adoc
index ca17bee..a67f0b1 100644
--- a/components/camel-file-watch/src/main/docs/file-watch-component.adoc
+++ b/components/camel-file-watch/src/main/docs/file-watch-component.adoc
@@ -8,13 +8,18 @@ This component can be used to watch file modification events 
in folder. It is ba
 === URI Options
 
 // component options: START
-The file-watch component supports 2 options, which are listed below.
+The file-watch component supports 7 options, which are listed below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *concurrentConsumers* (consumer) | The number of concurrent consumers. 
Increase this value, if your route is slow to prevent buffering in queue. | 1 | 
int
+| *queueSize* (consumer) | Maximum size of queue between WatchService and 
consumer. Unbounded by default. | 2147483647 | int
+| *pollThreads* (consumer) | The number of threads polling WatchService. 
Increase this value, if you see OVERFLOW messages in log. | 1 | int
+| *fileHasher* (consumer) | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. | #murmur3FFileHasher | 
FileHasher
+| *useFileHashing* (consumer) | Enables or disables file hashing to detect 
duplicate events. If you disable this, you can get some events multiple times 
on some platforms and JDKs. Check java.nio.file.WatchService limitations for 
your target platform. | true | boolean
 | *resolveProperty Placeholders* (advanced) | Whether the component should 
resolve property placeholders on itself when starting. Only properties which 
are of String type can use property placeholders. | true | boolean
 | *basicPropertyBinding* (advanced) | Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
 |===
@@ -50,7 +55,7 @@ with the following path and query parameters:
 | *autoCreate* (consumer) | Auto create directory if does not exists. | true | 
boolean
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *concurrentConsumers* (consumer) | The number of concurrent consumers. 
Increase this value, if your route is slow to prevent buffering in queue. | 1 | 
int
-| *events* (consumer) | Coma separated list of events to watch. Allowed values 
are: CREATE, MODIFY, DELETE. | CREATE,MODIFY,DELETE | Set
+| *events* (consumer) | Comma separated list of events to watch. | 
CREATE,MODIFY,DELETE | Set
 | *fileHasher* (consumer) | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. | #murmur3FFileHasher | 
FileHasher
 | *pollThreads* (consumer) | The number of threads polling WatchService. 
Increase this value, if you see OVERFLOW messages in log. | 1 | int
 | *queueSize* (consumer) | Maximum size of queue between WatchService and 
consumer. Unbounded by default. | 2147483647 | int
@@ -79,7 +84,7 @@ When using Spring Boot make sure to use the following Maven 
dependency to have s
 ----
 
 
-The component supports 3 options, which are listed below.
+The component supports 8 options, which are listed below.
 
 
 
@@ -87,8 +92,13 @@ The component supports 3 options, which are listed below.
 |===
 | Name | Description | Default | Type
 | *camel.component.file-watch.basic-property-binding* | Whether the component 
should use basic property binding (Camel 2.x) or the newer property binding 
with additional capabilities | false | Boolean
+| *camel.component.file-watch.concurrent-consumers* | The number of concurrent 
consumers. Increase this value, if your route is slow to prevent buffering in 
queue. | 1 | Integer
 | *camel.component.file-watch.enabled* | Whether to enable auto configuration 
of the file-watch component. This is enabled by default. |  | Boolean
+| *camel.component.file-watch.file-hasher* | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. The option is a 
io.methvin.watcher.hashing.FileHasher type. |  | String
+| *camel.component.file-watch.poll-threads* | The number of threads polling 
WatchService. Increase this value, if you see OVERFLOW messages in log. | 1 | 
Integer
+| *camel.component.file-watch.queue-size* | Maximum size of queue between 
WatchService and consumer. Unbounded by default. | 2147483647 | Integer
 | *camel.component.file-watch.resolve-property-placeholders* | Whether the 
component should resolve property placeholders on itself when starting. Only 
properties which are of String type can use property placeholders. | true | 
Boolean
+| *camel.component.file-watch.use-file-hashing* | Enables or disables file 
hashing to detect duplicate events. If you disable this, you can get some 
events multiple times on some platforms and JDKs. Check 
java.nio.file.WatchService limitations for your target platform. | true | 
Boolean
 |===
 // spring-boot-auto-configure options: END
 
diff --git 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchComponent.java
 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchComponent.java
index 03bafa6..7ed6398 100644
--- 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchComponent.java
+++ 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchComponent.java
@@ -20,6 +20,7 @@ import java.util.Map;
 
 import io.methvin.watcher.hashing.FileHasher;
 import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
@@ -31,21 +32,90 @@ import org.apache.camel.support.DefaultComponent;
 public class FileWatchComponent extends DefaultComponent {
     public static final String EVENT_TYPE_HEADER = "CamelFileEventType";
 
+    @Metadata(label = "consumer",
+    description = "The number of concurrent consumers. Increase this value, if 
your route is slow to prevent buffering in queue.",
+    defaultValue = "1")
+    private int concurrentConsumers = 1;
+
+    @Metadata(label = "consumer", description = "Maximum size of queue between 
WatchService and consumer. Unbounded by default.",
+    defaultValue = "" + Integer.MAX_VALUE)
+    private int queueSize = Integer.MAX_VALUE;
+
+    @Metadata(label = "consumer",
+    description = "The number of threads polling WatchService. Increase this 
value, if you see OVERFLOW messages in log.",
+    defaultValue = "1")
+    private int pollThreads = 1;
+
+    @Metadata(label = "consumer",
+    description = "Reference to io.methvin.watcher.hashing.FileHasher. "
+    + "This prevents emitting duplicate events on some platforms. "
+    + "For working with large files and if you dont need detect multiple 
modifications per second per file, "
+    + "use #lastModifiedTimeFileHasher. You can also provide custom 
implementation in registry.",
+    defaultValue = "#murmur3FFileHasher")
+    private FileHasher fileHasher = FileHasher.DEFAULT_FILE_HASHER;
+
+    @Metadata(label = "consumer",
+    description = "Enables or disables file hashing to detect duplicate 
events. "
+    + "If you disable this, you can get some events multiple times on some 
platforms and JDKs. "
+    + "Check java.nio.file.WatchService limitations for your target platform.",
+    defaultValue = "true")
+    private boolean useFileHashing = true;
+
+
+    public int getConcurrentConsumers() {
+        return concurrentConsumers;
+    }
+
+    public void setConcurrentConsumers(int concurrentConsumers) {
+        this.concurrentConsumers = concurrentConsumers;
+    }
+
+    public int getQueueSize() {
+        return queueSize;
+    }
+
+    public void setQueueSize(int queueSize) {
+        this.queueSize = queueSize;
+    }
+
+    public int getPollThreads() {
+        return pollThreads;
+    }
+
+    public void setPollThreads(int pollThreads) {
+        this.pollThreads = pollThreads;
+    }
+
+    public FileHasher getFileHasher() {
+        return fileHasher;
+    }
+
+    public void setFileHasher(FileHasher fileHasher) {
+        this.fileHasher = fileHasher;
+    }
+
+    public boolean isUseFileHashing() {
+        return useFileHashing;
+    }
+
+    public void setUseFileHashing(boolean useFileHashing) {
+        this.useFileHashing = useFileHashing;
+    }
+
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         Endpoint endpoint = new FileWatchEndpoint(uri, remaining, this);
         setProperties(endpoint, parameters);
         return endpoint;
     }
 
+    /**
+     * Register common FileHashers to registry, to make this available 
out-of-box to use in endpoint definition.
+     */
     @Override
-    protected void doStart() throws Exception {
-        super.doStart();
+    protected void doInit() throws Exception {
+        super.doInit();
         Registry registry = getCamelContext().getRegistry();
-        if (registry.lookupByNameAndType("murmur3FFileHasher", 
FileHasher.class) == null) {
-            registry.bind("murmur3FFileHasher", FileHasher.class, 
FileHasher.DEFAULT_FILE_HASHER);
-        }
-        if (registry.lookupByNameAndType("lastModifiedTimeFileHasher", 
FileHasher.class) == null) {
-            registry.bind("lastModifiedTimeFileHasher", FileHasher.class, 
FileHasher.LAST_MODIFIED_TIME);
-        }
+        registry.bind("murmur3FFileHasher", FileHasher.class, 
FileHasher.DEFAULT_FILE_HASHER);
+        registry.bind("lastModifiedTimeFileHasher", FileHasher.class, 
FileHasher.LAST_MODIFIED_TIME);
     }
 }
diff --git 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchConsumer.java
 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchConsumer.java
index ece2040..a0f5718 100644
--- 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchConsumer.java
+++ 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchConsumer.java
@@ -70,12 +70,12 @@ public class FileWatchConsumer extends DefaultConsumer {
             if (getEndpoint().isAutoCreate()) {
                 baseDirectory = Files.createDirectories(baseDirectory);
             } else {
-                throw new RuntimeCamelException("Path must exists when 
autoCreate = false");
+                throw new IllegalArgumentException("Path must exists when 
autoCreate = false");
             }
         }
 
         if (!Files.isDirectory(baseDirectory)) {
-            throw new RuntimeCamelException(String.format("Parameter path must 
be directory, %s given", baseDirectory.toString()));
+            throw new IllegalArgumentException(String.format("Parameter path 
must be directory, %s given", baseDirectory.toString()));
         }
 
         DirectoryWatcher.Builder watcherBuilder = DirectoryWatcher.builder()
diff --git 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchEndpoint.java
 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchEndpoint.java
index d56b983..468f5bc 100644
--- 
a/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchEndpoint.java
+++ 
b/components/camel-file-watch/src/main/java/org/apache/camel/component/file/watch/FileWatchEndpoint.java
@@ -43,7 +43,8 @@ public class FileWatchEndpoint extends DefaultEndpoint 
implements MultipleConsum
     private String path;
 
     @UriParam(label = "consumer",
-    description = "Coma separated list of events to watch. Allowed values are: 
CREATE, MODIFY, DELETE.",
+    enums = "CREATE,MODIFY,DELETE",
+    description = "Comma separated list of events to watch.",
     defaultValue = "CREATE,MODIFY,DELETE")
     private Set<FileEventEnum> events = new 
HashSet<>(Arrays.asList(FileEventEnum.values()));
 
@@ -56,12 +57,12 @@ public class FileWatchEndpoint extends DefaultEndpoint 
implements MultipleConsum
     @UriParam(label = "consumer",
     description = "The number of concurrent consumers. Increase this value, if 
your route is slow to prevent buffering in queue.",
     defaultValue = "1")
-    private int concurrentConsumers = 1;
+    private int concurrentConsumers;
 
     @UriParam(label = "consumer",
     description = "The number of threads polling WatchService. Increase this 
value, if you see OVERFLOW messages in log.",
     defaultValue = "1")
-    private int pollThreads = 1;
+    private int pollThreads;
 
     @UriParam(label = "consumer",
     description = "ANT style pattern to match files. The file is matched 
against path relative to endpoint path. "
@@ -71,7 +72,7 @@ public class FileWatchEndpoint extends DefaultEndpoint 
implements MultipleConsum
 
     @UriParam(label = "consumer", description = "Maximum size of queue between 
WatchService and consumer. Unbounded by default.",
     defaultValue = "" + Integer.MAX_VALUE)
-    private int queueSize = Integer.MAX_VALUE;
+    private int queueSize;
 
     @UriParam(label = "consumer",
     description = "Reference to io.methvin.watcher.hashing.FileHasher. "
@@ -79,24 +80,29 @@ public class FileWatchEndpoint extends DefaultEndpoint 
implements MultipleConsum
     + "For working with large files and if you dont need detect multiple 
modifications per second per file, "
     + "use #lastModifiedTimeFileHasher. You can also provide custom 
implementation in registry.",
     defaultValue = "#murmur3FFileHasher")
-    private FileHasher fileHasher = FileHasher.DEFAULT_FILE_HASHER;
+    private FileHasher fileHasher;
 
     @UriParam(label = "consumer",
     description = "Enables or disables file hashing to detect duplicate 
events. "
     + "If you disable this, you can get some events multiple times on some 
platforms and JDKs. "
     + "Check java.nio.file.WatchService limitations for your target platform.",
     defaultValue = "true")
-    private boolean useFileHashing = true;
+    private boolean useFileHashing;
 
     public FileWatchEndpoint() {
     }
 
     public FileWatchEndpoint(String uri, FileWatchComponent component) {
         super(uri, component);
+        setFileHasher(component.getFileHasher());
+        setConcurrentConsumers(component.getConcurrentConsumers());
+        setPollThreads(component.getPollThreads());
+        setQueueSize(component.getQueueSize());
+        setUseFileHashing(component.isUseFileHashing());
     }
 
     public FileWatchEndpoint(String uri, String remaining, FileWatchComponent 
component) {
-        super(uri, component);
+        this(uri, component);
         setPath(remaining);
     }
 
diff --git 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentTest.java
 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentTest.java
index 239a08b..48bab63 100644
--- 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentTest.java
+++ 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentTest.java
@@ -115,8 +115,6 @@ public class FileWatchComponentTest extends 
FileWatchComponentTestBase {
         MockEndpoint mock = getMockEndpoint("mock:watchAll");
 
         Files.write(testFiles.get(0), "Hello".getBytes(), 
StandardOpenOption.SYNC);
-        //testFiles.get(0).toFile().renameTo(new File(testPath(), 
"hello.txt"));
-        //Assert.assertTrue(newFile.createNewFile());
 
         mock.setExpectedCount(1);
         mock.setResultWaitTime(1000);
diff --git 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/SpringFileWatcherTest.java
 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/SpringFileWatcherTest.java
index 55d8b5f..7e5e42e 100644
--- 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/SpringFileWatcherTest.java
+++ 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/SpringFileWatcherTest.java
@@ -47,6 +47,9 @@ public class SpringFileWatcherTest extends 
CamelSpringTestSupport {
     @Test
     public void testDefaultConfig() throws Exception {
         Files.write(springTestFile.toPath(), "modification".getBytes(), 
StandardOpenOption.SYNC);
+        // Adding few millis to avoid fleaky tests
+        // The file hasher could sometimes evaluate these two changes as 
duplicate, as the second modification of file could be done before hashing is 
done
+        Thread.sleep(50);
         Files.write(springTestFile.toPath(), "modification 2".getBytes(), 
StandardOpenOption.SYNC);
         MockEndpoint mock = getMockEndpoint("mock:springTest");
         mock.setExpectedCount(2); // two MODIFY events
@@ -58,6 +61,9 @@ public class SpringFileWatcherTest extends 
CamelSpringTestSupport {
     @Test
     public void testCustomHasher() throws Exception {
         Files.write(springTestCustomHasherFile.toPath(), "first 
modification".getBytes(), StandardOpenOption.SYNC);
+        // Adding few millis to avoid fleaky tests
+        // The file hasher could sometimes evaluate these two changes as 
duplicate, as the second modification of file could be done before hashing is 
done
+        Thread.sleep(50);
         Files.write(springTestCustomHasherFile.toPath(), "second 
modification".getBytes(), StandardOpenOption.SYNC);
 
         MockEndpoint mock = getMockEndpoint("mock:springTestCustomHasher");
diff --git a/docs/components/modules/ROOT/nav.adoc 
b/docs/components/modules/ROOT/nav.adoc
index 9510ef0..c14a30c 100644
--- a/docs/components/modules/ROOT/nav.adoc
+++ b/docs/components/modules/ROOT/nav.adoc
@@ -105,6 +105,7 @@
 * xref:fhir-component.adoc[FHIR Component]
 * xref:fhirJson-dataformat.adoc[FHIR JSon DataFormat]
 * xref:fhirXml-dataformat.adoc[FHIR XML DataFormat]
+* xref:file-watch-component.adoc[file-watch Component]
 * xref:file-component.adoc[File Component]
 * xref:flatpack-component.adoc[Flatpack Component]
 * xref:flatpack-dataformat.adoc[Flatpack DataFormat]
diff --git a/docs/components/modules/ROOT/pages/file-watch-component.adoc 
b/docs/components/modules/ROOT/pages/file-watch-component.adoc
index ca17bee..a67f0b1 100644
--- a/docs/components/modules/ROOT/pages/file-watch-component.adoc
+++ b/docs/components/modules/ROOT/pages/file-watch-component.adoc
@@ -8,13 +8,18 @@ This component can be used to watch file modification events 
in folder. It is ba
 === URI Options
 
 // component options: START
-The file-watch component supports 2 options, which are listed below.
+The file-watch component supports 7 options, which are listed below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *concurrentConsumers* (consumer) | The number of concurrent consumers. 
Increase this value, if your route is slow to prevent buffering in queue. | 1 | 
int
+| *queueSize* (consumer) | Maximum size of queue between WatchService and 
consumer. Unbounded by default. | 2147483647 | int
+| *pollThreads* (consumer) | The number of threads polling WatchService. 
Increase this value, if you see OVERFLOW messages in log. | 1 | int
+| *fileHasher* (consumer) | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. | #murmur3FFileHasher | 
FileHasher
+| *useFileHashing* (consumer) | Enables or disables file hashing to detect 
duplicate events. If you disable this, you can get some events multiple times 
on some platforms and JDKs. Check java.nio.file.WatchService limitations for 
your target platform. | true | boolean
 | *resolveProperty Placeholders* (advanced) | Whether the component should 
resolve property placeholders on itself when starting. Only properties which 
are of String type can use property placeholders. | true | boolean
 | *basicPropertyBinding* (advanced) | Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
 |===
@@ -50,7 +55,7 @@ with the following path and query parameters:
 | *autoCreate* (consumer) | Auto create directory if does not exists. | true | 
boolean
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *concurrentConsumers* (consumer) | The number of concurrent consumers. 
Increase this value, if your route is slow to prevent buffering in queue. | 1 | 
int
-| *events* (consumer) | Coma separated list of events to watch. Allowed values 
are: CREATE, MODIFY, DELETE. | CREATE,MODIFY,DELETE | Set
+| *events* (consumer) | Comma separated list of events to watch. | 
CREATE,MODIFY,DELETE | Set
 | *fileHasher* (consumer) | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. | #murmur3FFileHasher | 
FileHasher
 | *pollThreads* (consumer) | The number of threads polling WatchService. 
Increase this value, if you see OVERFLOW messages in log. | 1 | int
 | *queueSize* (consumer) | Maximum size of queue between WatchService and 
consumer. Unbounded by default. | 2147483647 | int
@@ -79,7 +84,7 @@ When using Spring Boot make sure to use the following Maven 
dependency to have s
 ----
 
 
-The component supports 3 options, which are listed below.
+The component supports 8 options, which are listed below.
 
 
 
@@ -87,8 +92,13 @@ The component supports 3 options, which are listed below.
 |===
 | Name | Description | Default | Type
 | *camel.component.file-watch.basic-property-binding* | Whether the component 
should use basic property binding (Camel 2.x) or the newer property binding 
with additional capabilities | false | Boolean
+| *camel.component.file-watch.concurrent-consumers* | The number of concurrent 
consumers. Increase this value, if your route is slow to prevent buffering in 
queue. | 1 | Integer
 | *camel.component.file-watch.enabled* | Whether to enable auto configuration 
of the file-watch component. This is enabled by default. |  | Boolean
+| *camel.component.file-watch.file-hasher* | Reference to 
io.methvin.watcher.hashing.FileHasher. This prevents emitting duplicate events 
on some platforms. For working with large files and if you dont need detect 
multiple modifications per second per file, use #lastModifiedTimeFileHasher. 
You can also provide custom implementation in registry. The option is a 
io.methvin.watcher.hashing.FileHasher type. |  | String
+| *camel.component.file-watch.poll-threads* | The number of threads polling 
WatchService. Increase this value, if you see OVERFLOW messages in log. | 1 | 
Integer
+| *camel.component.file-watch.queue-size* | Maximum size of queue between 
WatchService and consumer. Unbounded by default. | 2147483647 | Integer
 | *camel.component.file-watch.resolve-property-placeholders* | Whether the 
component should resolve property placeholders on itself when starting. Only 
properties which are of String type can use property placeholders. | true | 
Boolean
+| *camel.component.file-watch.use-file-hashing* | Enables or disables file 
hashing to detect duplicate events. If you disable this, you can get some 
events multiple times on some platforms and JDKs. Check 
java.nio.file.WatchService limitations for your target platform. | true | 
Boolean
 |===
 // spring-boot-auto-configure options: END
 
diff --git 
a/platforms/spring-boot/components-starter/camel-file-watch-starter/src/main/java/org/apache/camel/component/file/watch/springboot/FileWatchComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-file-watch-starter/src/main/java/org/apache/camel/component/file/watch/springboot/FileWatchComponentConfiguration.java
index 7eca738..f72d10f 100644
--- 
a/platforms/spring-boot/components-starter/camel-file-watch-starter/src/main/java/org/apache/camel/component/file/watch/springboot/FileWatchComponentConfiguration.java
+++ 
b/platforms/spring-boot/components-starter/camel-file-watch-starter/src/main/java/org/apache/camel/component/file/watch/springboot/FileWatchComponentConfiguration.java
@@ -38,6 +38,37 @@ public class FileWatchComponentConfiguration
      */
     private Boolean enabled;
     /**
+     * The number of concurrent consumers. Increase this value, if your route 
is
+     * slow to prevent buffering in queue.
+     */
+    private Integer concurrentConsumers = 1;
+    /**
+     * Maximum size of queue between WatchService and consumer. Unbounded by
+     * default.
+     */
+    private Integer queueSize = 2147483647;
+    /**
+     * The number of threads polling WatchService. Increase this value, if you
+     * see OVERFLOW messages in log.
+     */
+    private Integer pollThreads = 1;
+    /**
+     * Reference to io.methvin.watcher.hashing.FileHasher. This prevents
+     * emitting duplicate events on some platforms. For working with large 
files
+     * and if you dont need detect multiple modifications per second per file,
+     * use #lastModifiedTimeFileHasher. You can also provide custom
+     * implementation in registry. The option is a
+     * io.methvin.watcher.hashing.FileHasher type.
+     */
+    private String fileHasher;
+    /**
+     * Enables or disables file hashing to detect duplicate events. If you
+     * disable this, you can get some events multiple times on some platforms
+     * and JDKs. Check java.nio.file.WatchService limitations for your target
+     * platform.
+     */
+    private Boolean useFileHashing = true;
+    /**
      * Whether the component should resolve property placeholders on itself 
when
      * starting. Only properties which are of String type can use property
      * placeholders.
@@ -49,6 +80,46 @@ public class FileWatchComponentConfiguration
      */
     private Boolean basicPropertyBinding = false;
 
+    public Integer getConcurrentConsumers() {
+        return concurrentConsumers;
+    }
+
+    public void setConcurrentConsumers(Integer concurrentConsumers) {
+        this.concurrentConsumers = concurrentConsumers;
+    }
+
+    public Integer getQueueSize() {
+        return queueSize;
+    }
+
+    public void setQueueSize(Integer queueSize) {
+        this.queueSize = queueSize;
+    }
+
+    public Integer getPollThreads() {
+        return pollThreads;
+    }
+
+    public void setPollThreads(Integer pollThreads) {
+        this.pollThreads = pollThreads;
+    }
+
+    public String getFileHasher() {
+        return fileHasher;
+    }
+
+    public void setFileHasher(String fileHasher) {
+        this.fileHasher = fileHasher;
+    }
+
+    public Boolean getUseFileHashing() {
+        return useFileHashing;
+    }
+
+    public void setUseFileHashing(Boolean useFileHashing) {
+        this.useFileHashing = useFileHashing;
+    }
+
     public Boolean getResolvePropertyPlaceholders() {
         return resolvePropertyPlaceholders;
     }

Reply via email to