Class RouteWatcherReloadStrategy

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.ResourceReloadStrategy, org.apache.camel.StatefulService, org.apache.camel.StaticService, org.apache.camel.SuspendableService

    public class RouteWatcherReloadStrategy
    extends FileWatcherResourceReloadStrategy
    Watcher strategy for triggering reloading of Camel routes in a running Camel application. The strategy watches a directory (and subdirectories) for file changes. By default, the strategy is matching Camel routes in XML or YAML files.
    • Field Detail

      • RELOAD_RESOURCES

        public static final String RELOAD_RESOURCES
        Special when reloading routes(s) requires to also ensure other resources are reloaded together such as camel-java-joor-dsl to ensure all resources are compiled in the same compilation unit.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RouteWatcherReloadStrategy

        public RouteWatcherReloadStrategy()
      • RouteWatcherReloadStrategy

        public RouteWatcherReloadStrategy​(String directory)
      • RouteWatcherReloadStrategy

        public RouteWatcherReloadStrategy​(String directory,
                                          boolean recursive)
    • Method Detail

      • getPattern

        public String getPattern()
      • setPattern

        public void setPattern​(String pattern)
        Used for inclusive filtering of routes from directories. Typical used for specifying to accept routes in XML or YAML files, such as *.yaml,*.xml. Multiple patterns can be specified separated by comma.
      • isRemoveAllRoutes

        public boolean isRemoveAllRoutes()
      • setRemoveAllRoutes

        public void setRemoveAllRoutes​(boolean removeAllRoutes)
        When reloading routes should all existing routes be stopped and removed. By default, Camel will stop and remove all existing routes before reloading routes. This ensures that only the reloaded routes will be active. If disabled then only routes with the same route id is updated, and any existing routes are continued to run.
      • onPropertiesReload

        protected void onPropertiesReload​(org.apache.camel.spi.Resource resource)
      • onRouteReload

        protected void onRouteReload​(org.apache.camel.spi.Resource resource)