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, suspending
DESCRIPTION_PROPERTY, GROUP_PROPERTY, ID_PROPERTY, PARENT_PROPERTY, REST_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.
|
String |
getDescription()
Gets the route description (if any has been configured).
|
Endpoint |
getEndpoint()
Gets the endpoint associated with an object.
|
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, isSuspendingOrSuspended, resume, shutdown, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConsumer, navigate, supportsSuspension
public DefaultRoute(RouteContext routeContext, Endpoint endpoint)
public DefaultRoute(RouteContext routeContext, Endpoint endpoint, Service... services)
public Endpoint getEndpoint()
EndpointAware
Producer
or for consuming from for components like Consumer
or Route
getEndpoint
in interface EndpointAware
public RouteContext getRouteContext()
Route
getRouteContext
in interface Route
public Map<String,Object> getProperties()
Route
getProperties
in interface Route
public String getDescription()
Route
Route.DESCRIPTION_PROPERTY
as key in the Route.getProperties()
.getDescription
in interface Route
public void onStartingServices(List<Service> services) throws Exception
Route
onStartingServices
in interface Route
services
- the serviceException
- is thrown in case of errorpublic List<Service> getServices()
Route
getServices
in interface Route
public void addService(Service service)
Route
addService
in interface Route
service
- the servicepublic void warmUp()
Route
public void start() throws Exception
CamelContext.startRoute(String)
to start a route.start
in interface Service
start
in class ServiceSupport
Exception
- is thrown if starting failedpublic void stop() throws Exception
CamelContext.stopRoute(String)
to stop a route.stop
in interface Service
stop
in class ServiceSupport
Exception
- is thrown if stopping failedprotected void addServices(List<Service> services) throws Exception
Exception
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.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 ServiceSupport
Exception
ServiceSupport.doStart()
protected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
Apache Camel