Package org.apache.camel.component.seda
Class SedaConsumer
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultConsumer
-
- org.apache.camel.component.seda.SedaConsumer
-
- All Implemented Interfaces:
AutoCloseable,Runnable,org.apache.camel.Consumer,org.apache.camel.EndpointAware,org.apache.camel.health.HealthCheckAware,org.apache.camel.RouteAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.RouteIdAware,org.apache.camel.spi.ShutdownAware,org.apache.camel.spi.ShutdownPrepared,org.apache.camel.StatefulService,org.apache.camel.Suspendable,org.apache.camel.SuspendableService
public class SedaConsumer extends org.apache.camel.support.DefaultConsumer implements Runnable, org.apache.camel.spi.ShutdownAware, org.apache.camel.Suspendable
A Consumer for the SEDA component. In this implementation there is a little slack period when you suspend/stop the consumer, by which the consumer may pickup a newly arrived messages and process it. That period is up till 1 second.
-
-
Constructor Summary
Constructors Constructor Description SedaConsumer(SedaEndpoint endpoint, org.apache.camel.Processor processor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandeferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)protected voiddoResume()protected voiddoRun()protected voiddoShutdown()protected voiddoStart()protected voiddoStop()protected voiddoSuspend()SedaEndpointgetEndpoint()intgetPendingExchangesSize()booleanisRunAllowed()protected org.apache.camel.ExchangeprepareExchange(org.apache.camel.Exchange exchange)Strategy to prepare exchange for being processed by this consumervoidprepareShutdown(boolean suspendOnly, boolean forced)voidrun()protected voidsendToConsumers(org.apache.camel.Exchange exchange)Send the givenExchangeto the consumer(s).-
Methods inherited from class org.apache.camel.support.DefaultConsumer
createExchange, createUoW, defaultConsumerCallback, doBuild, doInit, doneUoW, getAsyncProcessor, getExceptionHandler, getHealthCheck, getProcessor, getRoute, getRouteId, handleException, handleException, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, fail, getStatus, init, isBuild, isInit, isNew, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
SedaConsumer
public SedaConsumer(SedaEndpoint endpoint, org.apache.camel.Processor processor)
-
-
Method Detail
-
getEndpoint
public SedaEndpoint getEndpoint()
- Specified by:
getEndpointin interfaceorg.apache.camel.EndpointAware- Overrides:
getEndpointin classorg.apache.camel.support.DefaultConsumer
-
deferShutdown
public boolean deferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
- Specified by:
deferShutdownin interfaceorg.apache.camel.spi.ShutdownAware
-
getPendingExchangesSize
public int getPendingExchangesSize()
- Specified by:
getPendingExchangesSizein interfaceorg.apache.camel.spi.ShutdownAware
-
prepareShutdown
public void prepareShutdown(boolean suspendOnly, boolean forced)- Specified by:
prepareShutdownin interfaceorg.apache.camel.spi.ShutdownPrepared
-
isRunAllowed
public boolean isRunAllowed()
- Specified by:
isRunAllowedin interfaceorg.apache.camel.StatefulService- Overrides:
isRunAllowedin classorg.apache.camel.support.service.BaseService
-
doRun
protected void doRun()
-
prepareExchange
protected org.apache.camel.Exchange prepareExchange(org.apache.camel.Exchange exchange)
Strategy to prepare exchange for being processed by this consumer- Parameters:
exchange- the exchange- Returns:
- the exchange to process by this consumer.
-
sendToConsumers
protected void sendToConsumers(org.apache.camel.Exchange exchange) throws ExceptionSend the givenExchangeto the consumer(s). If multiple consumers then they will each receive a copy of the Exchange. A multicast processor will send the exchange in parallel to the multiple consumers. If there is only a single consumer then its dispatched directly to it using same thread.- Parameters:
exchange- the exchange- Throws:
Exception- can be thrown if processing of the exchange failed
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doSuspend
protected void doSuspend() throws Exception- Overrides:
doSuspendin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doResume
protected void doResume() throws Exception- Overrides:
doResumein classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
-