Package org.apache.camel.support
Class RouteWatcherReloadStrategy
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.ResourceReloadStrategySupport
-
- org.apache.camel.support.FileWatcherResourceReloadStrategy
-
- org.apache.camel.support.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.camel.support.FileWatcherResourceReloadStrategy
FileWatcherResourceReloadStrategy.WatchFileChangesTask
-
-
Field Summary
Fields Modifier and Type Field Description static 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.
-
Constructor Summary
Constructors Constructor Description RouteWatcherReloadStrategy()
RouteWatcherReloadStrategy(String directory)
RouteWatcherReloadStrategy(String directory, boolean recursive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doStart()
String
getPattern()
boolean
isRemoveAllRoutes()
protected void
onPropertiesReload(org.apache.camel.spi.Resource resource)
protected void
onRouteReload(org.apache.camel.spi.Resource resource)
void
setPattern(String pattern)
Used for inclusive filtering of routes from directories.void
setRemoveAllRoutes(boolean removeAllRoutes)
When reloading routes should all existing routes be stopped and removed.protected String
startupMessage(File dir)
-
Methods inherited from class org.apache.camel.support.FileWatcherResourceReloadStrategy
doStop, getFileFilter, getFolder, isRecursive, isRunning, setFileFilter, setFolder, setPollTimeout, setRecursive
-
Methods inherited from class org.apache.camel.support.ResourceReloadStrategySupport
getCamelContext, getFailedCounter, getReloadCounter, getResourceReload, incFailedCounter, incSucceededCounter, resetCounters, setCamelContext, setFailed, setResourceReload, setSucceeded
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
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
-
-
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.
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classFileWatcherResourceReloadStrategy
- Throws:
Exception
-
startupMessage
protected String startupMessage(File dir)
- Overrides:
startupMessage
in classFileWatcherResourceReloadStrategy
-
onPropertiesReload
protected void onPropertiesReload(org.apache.camel.spi.Resource resource)
-
onRouteReload
protected void onRouteReload(org.apache.camel.spi.Resource resource)
-
-