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.HasCamelContext
,org.apache.camel.spi.ReloadStrategy
,org.apache.camel.spi.ResourceReloadStrategy
,org.apache.camel.StatefulService
,org.apache.camel.StaticService
,org.apache.camel.SuspendableService
- Direct Known Subclasses:
RouteOnDemandReloadStrategy
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
Modifier and TypeFieldDescriptionstatic final String
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.Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
ConstructorDescriptionRouteWatcherReloadStrategy
(String directory) RouteWatcherReloadStrategy
(String directory, boolean recursive) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
boolean
protected boolean
onPropertiesReload
(org.apache.camel.spi.Resource resource, boolean reloadRoutes) protected void
onRouteReload
(Collection<org.apache.camel.spi.Resource> resources, boolean removeEverything) 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, onReload, setFileFilter, setFolder, setPollTimeout, setRecursive, setScheduler
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, getInternalLock, 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
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
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:
-
-
Constructor Details
-
RouteWatcherReloadStrategy
public RouteWatcherReloadStrategy() -
RouteWatcherReloadStrategy
-
RouteWatcherReloadStrategy
-
-
Method Details
-
getPattern
-
setPattern
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
- Overrides:
doStart
in classFileWatcherResourceReloadStrategy
- Throws:
Exception
-
startupMessage
- Overrides:
startupMessage
in classFileWatcherResourceReloadStrategy
-
onPropertiesReload
protected boolean onPropertiesReload(org.apache.camel.spi.Resource resource, boolean reloadRoutes) throws Exception - Throws:
Exception
-
onRouteReload
protected void onRouteReload(Collection<org.apache.camel.spi.Resource> resources, boolean removeEverything)
-