Package org.apache.camel
Interface StartupListener
-
- All Known Subinterfaces:
ExtendedStartupListener
public interface StartupListener
Allows objects to be notified whenCamelContext
has almost done all work when starting. The state ofCamelContext
may still be in starting when this callback is invoked, this is by design. The callback is invoked during the routes startup procedure when startingCamelContext
. This can be used to perform any custom work when the entireCamelContext
has been initialized and almost started. This callback is invoked twice during starting the Camel routes, once before the route consumers are started, and once again after the route consumer has just been started. This is by design to allow Camel components to react accordingly and for example to register custom startup listeners during starting consumers. If you want to have only one callback after the route consumers has been fully started then use theExtendedStartupListener
instead. For example the QuartzComponent leverages this to ensure the Quartz scheduler does not start until after all the Camel routes and services have already been started. Important: You cannot use this listener to add and start new routes to theCamelContext
as this is not supported by design, as this listener plays a role during starting up routes. Instead you can use anEventNotifier
and listen on theCamelEvent.CamelContextStartedEvent
event and then add and start new routes from there. Instead use theExtendedStartupListener
if you wish to add new routes.- See Also:
ExtendedStartupListener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
onCamelContextFullyStarted(CamelContext context, boolean alreadyStarted)
Callback invoked when theCamelContext
has been fully started.void
onCamelContextStarted(CamelContext context, boolean alreadyStarted)
Callback invoked when theCamelContext
is about to be fully started (not started yet).default void
onCamelContextStarting(CamelContext context, boolean alreadyStarted)
Callback invoked when theCamelContext
is being started.
-
-
-
Method Detail
-
onCamelContextStarting
default void onCamelContextStarting(CamelContext context, boolean alreadyStarted) throws Exception
Callback invoked when theCamelContext
is being started.- Parameters:
context
- the Camel contextalreadyStarted
- whether or not theCamelContext
already has been started. For example the context could already have been started, and then a service is added/started later which still triggers this callback to be invoked.- Throws:
Exception
- can be thrown in case of errors to fail the startup process and have the application fail on startup.
-
onCamelContextStarted
void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception
Callback invoked when theCamelContext
is about to be fully started (not started yet). Yes we are aware of the method name, but we can all have a bad-naming day.- Parameters:
context
- the Camel contextalreadyStarted
- whether or not theCamelContext
already has been started. For example the context could already have been started, and then a service is added/started later which still triggers this callback to be invoked.- Throws:
Exception
- can be thrown in case of errors to fail the startup process and have the application fail on startup.
-
onCamelContextFullyStarted
default void onCamelContextFullyStarted(CamelContext context, boolean alreadyStarted) throws Exception
Callback invoked when theCamelContext
has been fully started.- Parameters:
context
- the Camel contextalreadyStarted
- whether or not theCamelContext
already has been started. For example the context could already have been started, and then a service is added/started later which still triggers this callback to be invoked.- Throws:
Exception
- can be thrown in case of errors to fail the startup process and have the application fail on startup.
-
-