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.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 boolean
deferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
protected void
doResume()
protected void
doRun()
protected void
doShutdown()
protected void
doStart()
protected void
doStop()
protected void
doSuspend()
SedaEndpoint
getEndpoint()
int
getPendingExchangesSize()
boolean
isRunAllowed()
protected org.apache.camel.Exchange
prepareExchange(org.apache.camel.Exchange exchange)
Strategy to prepare exchange for being processed by this consumervoid
prepareShutdown(boolean suspendOnly, boolean forced)
void
run()
protected void
sendToConsumers(org.apache.camel.Exchange exchange)
Send the givenExchange
to the consumer(s).-
Methods inherited from class org.apache.camel.support.DefaultConsumer
createExchange, createUoW, defaultConsumerCallback, doBuild, doInit, doneUoW, getAsyncProcessor, getExceptionHandler, getProcessor, getRoute, getRouteId, handleException, handleException, releaseExchange, setExceptionHandler, 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:
getEndpoint
in interfaceorg.apache.camel.EndpointAware
- Overrides:
getEndpoint
in classorg.apache.camel.support.DefaultConsumer
-
deferShutdown
public boolean deferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
- Specified by:
deferShutdown
in interfaceorg.apache.camel.spi.ShutdownAware
-
getPendingExchangesSize
public int getPendingExchangesSize()
- Specified by:
getPendingExchangesSize
in interfaceorg.apache.camel.spi.ShutdownAware
-
prepareShutdown
public void prepareShutdown(boolean suspendOnly, boolean forced)
- Specified by:
prepareShutdown
in interfaceorg.apache.camel.spi.ShutdownPrepared
-
isRunAllowed
public boolean isRunAllowed()
- Specified by:
isRunAllowed
in interfaceorg.apache.camel.StatefulService
- Overrides:
isRunAllowed
in 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 Exception
Send the givenExchange
to 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:
doStart
in classorg.apache.camel.support.DefaultConsumer
- Throws:
Exception
-
doSuspend
protected void doSuspend() throws Exception
- Overrides:
doSuspend
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doResume
protected void doResume() throws Exception
- Overrides:
doResume
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.DefaultConsumer
- Throws:
Exception
-
-