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.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask) protected voiddoResume()protected voiddoRun()protected voidprotected voiddoStart()protected voiddoStop()protected voidintbooleanprotected 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, handleException, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toStringMethods 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, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
SedaConsumer
-
-
Method Details
-
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
-
run
public void run() -
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
Send 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
- Overrides:
doStartin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doSuspend
- Overrides:
doSuspendin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doResume
- Overrides:
doResumein classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-