Repository: camel Updated Branches: refs/heads/master 51506f9c5 -> 03997ffd7
Polished Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/03997ffd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/03997ffd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/03997ffd Branch: refs/heads/master Commit: 03997ffd7e896d855128b7f1d147c95669419ad0 Parents: 51506f9 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Dec 20 14:46:47 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Dec 20 14:46:47 2016 +0100 ---------------------------------------------------------------------- examples/camel-example-reload/Readme.md | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/03997ffd/examples/camel-example-reload/Readme.md ---------------------------------------------------------------------- diff --git a/examples/camel-example-reload/Readme.md b/examples/camel-example-reload/Readme.md index d492766..1a8cec4 100644 --- a/examples/camel-example-reload/Readme.md +++ b/examples/camel-example-reload/Readme.md @@ -36,3 +36,36 @@ When the example is running then try to modify the XML file such as changing the </transform> You modify the source file directory in the `src/main/resources/META-INF/spring/` directory + +### Enabling live reload + +Live reload can be enabled on the 'camel:run' maven plugin as shown below: + + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-maven-plugin</artifactId> + <version>${project.version}</version> + <configuration> + <!-- turn on reload when the XML file is updated in the source code --> + <fileWatcherDirectory>src/main/resources/META-INF/spring</fileWatcherDirectory> + </configuration> + </plugin> + +The option `fileWatcherDirectory` is used to setup which directory to watch for file changes. +Notice how we point directly to the source code directory, so whenever you save the source file +its live reloaded. + +If you are using a Camel `Main` class, then you can enabled live reload as follows: + + public static void main(String[] args) throws Exception { + // Main makes it easier to run a Spring application + Main main = new Main(); + // configure the location of the Spring XML file + main.setApplicationContextUri("META-INF/spring/camel-context.xml"); + // turn on reload when the XML file is updated in the source code + main.setFileWatchDirectory("src/main/resources/META-INF/spring"); + // run and block until Camel is stopped (or JVM terminated) + main.run(); + } + +The main class has the `setFileWatchDirectory` where you can specify the directory to use. \ No newline at end of file