public abstract class DefaultRoute extends ServiceSupport implements Route
Route.
Use the API from CamelContext to control the lifecycle of a route,
such as starting and stopping using the CamelContext.startRoute(String)
and CamelContext.stopRoute(String) methods.shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspendingGROUP_PROPERTY, ID_PROPERTY, PARENT_PROPERTY| Constructor and Description |
|---|
DefaultRoute(RouteContext routeContext,
Endpoint endpoint) |
DefaultRoute(RouteContext routeContext,
Endpoint endpoint,
Service... services) |
| Modifier and Type | Method and Description |
|---|---|
void |
addService(Service service)
Adds a service to this route
|
protected void |
addServices(List<Service> services)
Strategy method to allow derived classes to lazily load services for the route
|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
Endpoint |
getEndpoint()
Gets the inbound endpoint
|
String |
getId()
Gets the route id
|
Map<String,Object> |
getProperties()
This property map is used to associate information about the route.
|
RouteContext |
getRouteContext()
Gets the route context
|
List<Service> |
getServices()
Returns the services for this particular route
|
void |
onStartingServices(List<Service> services)
A strategy callback allowing special initialization when services are starting.
|
void |
start()
Do not invoke this method directly, use
CamelContext.startRoute(String) to start a route. |
void |
stop()
Do not invoke this method directly, use
CamelContext.stopRoute(String) to stop a route. |
String |
toString() |
void |
warmUp()
Callback preparing the route to be started, by warming up the route.
|
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetConsumer, navigate, supportsSuspensionpublic DefaultRoute(RouteContext routeContext, Endpoint endpoint)
public DefaultRoute(RouteContext routeContext, Endpoint endpoint, Service... services)
public Endpoint getEndpoint()
RoutegetEndpoint in interface Routepublic RouteContext getRouteContext()
RoutegetRouteContext in interface Routepublic Map<String,Object> getProperties()
RoutegetProperties in interface Routepublic void onStartingServices(List<Service> services) throws Exception
RouteonStartingServices in interface Routeservices - the serviceException - is thrown in case of errorpublic List<Service> getServices()
RoutegetServices in interface Routepublic void addService(Service service)
RouteaddService in interface Routeservice - the servicepublic void warmUp()
Routepublic void start() throws Exception
CamelContext.startRoute(String) to start a route.start in interface Servicestart in class ServiceSupportException - is thrown if starting failedpublic void stop() throws Exception
CamelContext.stopRoute(String) to stop a route.stop in interface Servicestop in class ServiceSupportException - is thrown if stopping failedprotected void addServices(List<Service> services) throws Exception
Exceptionprotected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()protected void doShutdown() throws Exception
ServiceSupportdoShutdown in class ServiceSupportExceptionApache Camel