public class DeferServiceStartupListener extends Object implements StartupListener, Ordered
StartupListener
that defers starting Service
s, until as late as possible during
the startup process of CamelContext
.Constructor and Description |
---|
DeferServiceStartupListener() |
Modifier and Type | Method and Description |
---|---|
void |
addService(Service service) |
int |
getOrder()
Gets the order.
|
void |
onCamelContextStarted(CamelContext context,
boolean alreadyStarted)
Callback invoked when the
CamelContext is about to be fully started (not started yet). |
public DeferServiceStartupListener()
public void addService(Service service)
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception
StartupListener
CamelContext
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.onCamelContextStarted
in interface StartupListener
context
- the Camel contextalreadyStarted
- whether or not the CamelContext
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.Exception
- can be thrown in case of errors to fail the startup process and have the application
fail on startup.public int getOrder()
Ordered
Integer.MAX_VALUE
or eg Ordered.LOWEST
.Apache Camel