public class DefaultConsumer
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.Consumer, org.apache.camel.RouteAware, org.apache.camel.spi.RouteIdAware
Constructor and Description |
---|
DefaultConsumer(org.apache.camel.Endpoint endpoint,
org.apache.camel.Processor processor) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.spi.UnitOfWork |
createUoW(org.apache.camel.Exchange exchange)
If the consumer needs to defer done the
UnitOfWork on
the processed Exchange then this method should be use to create and start
the UnitOfWork on the exchange. |
protected void |
doInit() |
void |
doneUoW(org.apache.camel.Exchange exchange)
If the consumer needs to defer done the
UnitOfWork on
the processed Exchange then this method should be executed when the consumer
is finished processing the message. |
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.AsyncProcessor |
getAsyncProcessor()
Provides an
AsyncProcessor interface to the configured
processor on the consumer. |
org.apache.camel.Endpoint |
getEndpoint() |
org.apache.camel.spi.ExceptionHandler |
getExceptionHandler() |
org.apache.camel.Processor |
getProcessor() |
org.apache.camel.Route |
getRoute() |
String |
getRouteId() |
protected void |
handleException(String message,
Throwable t)
Handles the given exception using the
getExceptionHandler() |
protected void |
handleException(Throwable t)
Handles the given exception using the
getExceptionHandler() |
void |
setExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler) |
void |
setRoute(org.apache.camel.Route route) |
void |
setRouteId(String routeId) |
String |
toString() |
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DefaultConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor)
public org.apache.camel.Route getRoute()
getRoute
in interface org.apache.camel.RouteAware
public void setRoute(org.apache.camel.Route route)
setRoute
in interface org.apache.camel.RouteAware
public String getRouteId()
getRouteId
in interface org.apache.camel.spi.RouteIdAware
public void setRouteId(String routeId)
setRouteId
in interface org.apache.camel.spi.RouteIdAware
public org.apache.camel.spi.UnitOfWork createUoW(org.apache.camel.Exchange exchange) throws Exception
UnitOfWork
on
the processed Exchange
then this method should be use to create and start
the UnitOfWork
on the exchange.exchange
- the exchangeException
- is thrown if error starting the unit of workdoneUoW(org.apache.camel.Exchange)
public void doneUoW(org.apache.camel.Exchange exchange)
UnitOfWork
on
the processed Exchange
then this method should be executed when the consumer
is finished processing the message.exchange
- the exchangecreateUoW(org.apache.camel.Exchange)
public org.apache.camel.Endpoint getEndpoint()
getEndpoint
in interface org.apache.camel.EndpointAware
public org.apache.camel.Processor getProcessor()
getProcessor
in interface org.apache.camel.Consumer
public org.apache.camel.AsyncProcessor getAsyncProcessor()
AsyncProcessor
interface to the configured
processor on the consumer. If the processor does not implement the interface,
it will be adapted so that it does.public org.apache.camel.spi.ExceptionHandler getExceptionHandler()
public void setExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler)
protected void doInit() throws Exception
doInit
in class org.apache.camel.support.service.BaseService
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.service.BaseService
Exception
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.service.BaseService
Exception
protected void handleException(Throwable t)
getExceptionHandler()
t
- the exception to handleprotected void handleException(String message, Throwable t)
getExceptionHandler()
message
- additional message about the exceptiont
- the exception to handleApache Camel