Package org.apache.camel.main
Class MainSupport
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.main.BaseMainSupport
org.apache.camel.main.MainSupport
- Direct Known Subclasses:
MainCommandLineSupport
Class for main implementations to allow starting up a JVM with Camel embedded.
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.camel.ProducerTemplate
protected static final int
protected final AtomicInteger
protected static final org.slf4j.Logger
protected MainShutdownStrategy
protected static final int
Fields inherited from class org.apache.camel.main.BaseMainSupport
camelContext, defaultPropertyPlaceholderLocation, helper, initialProperties, listeners, mainConfigurationProperties, overrideProperties, propertyPlaceholderLocations, routesCollector, standalone, wildcardProperties
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
ModifierConstructorDescriptionprotected
protected
MainSupport
(Class<? extends org.apache.camel.CamelConfiguration>... configurationClasses) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Callback to run custom logic after CamelContext has been started.protected void
Callback to run custom logic after CamelContext has been stopped.protected void
autoconfigure
(org.apache.camel.CamelContext camelContext) protected void
Callback to run custom logic before CamelContext is being started.protected void
Callback to run custom logic before CamelContext is being stopped.void
Marks this process as being completed.protected void
configureLifecycle
(org.apache.camel.CamelContext camelContext) protected abstract org.apache.camel.CamelContext
protected void
doInit()
protected void
doStart()
protected void
doStop()
void
void
protected abstract org.apache.camel.ProducerTemplate
org.apache.camel.ProducerTemplate
Gets the complete task which allows to trigger this on demand.int
protected void
protected void
Tasks to run before start() is called.boolean
isTrace()
protected void
RegistersMainBootstrapCloseable
with the CamelContext.void
run()
Runs this process with the given arguments, and will wait until completed, or the JVM terminates.void
setAppName
(String appName) Application name (used for logging start and stop)void
setShutdownStrategy
(MainShutdownStrategy shutdownStrategy) Set theMainShutdownStrategy
used to properly shut-down the main instance.protected void
Methods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationFromReloadedProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autowireWildcardProperties, configure, configurePackageScan, configurePropertiesService, configureRoutes, configureRoutesLoader, configureStartupRecorder, createLifecycleStrategy, doAutoConfigurationFromProperties, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, loadConfigurations, loadCustomBeans, modelineRoutes, postProcessCamelContext, postProcessCamelRegistry, preProcessCamelRegistry, removeMainListener, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollector
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, 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
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
UNINITIALIZED_EXIT_CODE
protected static final int UNINITIALIZED_EXIT_CODE- See Also:
-
DEFAULT_EXIT_CODE
protected static final int DEFAULT_EXIT_CODE- See Also:
-
exitCode
-
shutdownStrategy
-
camelTemplate
protected volatile org.apache.camel.ProducerTemplate camelTemplate
-
-
Constructor Details
-
MainSupport
@SafeVarargs protected MainSupport(Class<? extends org.apache.camel.CamelConfiguration>... configurationClasses) -
MainSupport
protected MainSupport()
-
-
Method Details
-
doInit
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
autoconfigure
- Overrides:
autoconfigure
in classBaseMainSupport
- Throws:
Exception
-
run
Runs this process with the given arguments, and will wait until completed, or the JVM terminates.- Throws:
Exception
-
beforeStart
Callback to run custom logic before CamelContext is being started. It is recommended to useMainListener
instead.- Throws:
Exception
-
afterStart
Callback to run custom logic after CamelContext has been started. It is recommended to useMainListener
instead.- Throws:
Exception
-
internalBeforeStart
protected void internalBeforeStart()Tasks to run before start() is called. -
beforeStop
Callback to run custom logic before CamelContext is being stopped. It is recommended to useMainListener
instead.- Throws:
Exception
-
afterStop
Callback to run custom logic after CamelContext has been stopped. It is recommended to useMainListener
instead.- Throws:
Exception
-
completed
public void completed()Marks this process as being completed. -
getCompleteTask
Gets the complete task which allows to trigger this on demand. -
registerMainBootstrap
protected void registerMainBootstrap()RegistersMainBootstrapCloseable
with the CamelContext. -
getExitCode
public int getExitCode() -
isTrace
public boolean isTrace() -
enableTrace
public void enableTrace() -
enableTraceStandby
public void enableTraceStandby() -
getShutdownStrategy
-
setShutdownStrategy
Set theMainShutdownStrategy
used to properly shut-down the main instance. By default aDefaultMainShutdownStrategy
will be used.- Parameters:
shutdownStrategy
- the shutdown strategy
-
getAppName
-
setAppName
Application name (used for logging start and stop) -
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
configureLifecycle
- Overrides:
configureLifecycle
in classBaseMainSupport
- Throws:
Exception
-
waitUntilCompleted
protected void waitUntilCompleted() -
findOrCreateCamelTemplate
protected abstract org.apache.camel.ProducerTemplate findOrCreateCamelTemplate() -
createCamelContext
protected abstract org.apache.camel.CamelContext createCamelContext() -
getCamelTemplate
- Throws:
Exception
-
initCamelContext
- Throws:
Exception
-