Class DynamicRouterProcessor
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.AsyncProcessorSupport
org.apache.camel.component.dynamicrouter.routing.DynamicRouterProcessor
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AsyncProcessor,org.apache.camel.Processor,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public class DynamicRouterProcessor
extends org.apache.camel.support.AsyncProcessorSupport
The
DynamicRouterProcessor is responsible for routing an exchange to the appropriate recipients. It uses the
DynamicRouterFilterService to determine which filters match the exchange, and then sets the recipient list
header on the exchange to the list of matching filters. The RecipientList processor is then used to route the
exchange to the matching recipients.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFactory for creatingDynamicRouterProcessorinstances. -
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
ConstructorsConstructorDescriptionDynamicRouterProcessor(String recipientMode, boolean warnDroppedMessage, String channel, org.apache.camel.processor.RecipientList recipientList, DynamicRouterFilterService filterService) Construct theDynamicRouterProcessorinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringmatchFilters(org.apache.camel.Exchange exchange) Match the exchange against all filters to determine if any of them are suitable to handle the exchange.voidprepareExchange(org.apache.camel.Exchange exchange) Prepare the exchange for processing by matching the exchange against the filters, and setting the recipient list based on matching filter URIs.voidprocess(org.apache.camel.Exchange exchange) Process the exchange asynchronously.booleanprocess(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Process the exchange, and use theAsyncCallbackto signal completion.Methods inherited from class org.apache.camel.support.AsyncProcessorSupport
processAsyncMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, 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, toString, 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, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
DynamicRouterProcessor
public DynamicRouterProcessor(String recipientMode, boolean warnDroppedMessage, String channel, org.apache.camel.processor.RecipientList recipientList, DynamicRouterFilterService filterService) Construct theDynamicRouterProcessorinstance.- Parameters:
recipientMode- the recipient modewarnDroppedMessage- flag from the configuration to indicate if a dropped message should be logged at the 'WARN' levelchannel- the channel of the Dynamic Router that this processor servicesrecipientList- the recipient list processorfilterService- service that managesPrioritizedFilters for dynamic router channels
-
-
Method Details
-
matchFilters
Match the exchange against all filters to determine if any of them are suitable to handle the exchange.- Parameters:
exchange- the message exchange- Returns:
- list of filters that match for the exchange; if "firstMatch" mode, it is a singleton list of that filter
-
prepareExchange
public void prepareExchange(org.apache.camel.Exchange exchange) Prepare the exchange for processing by matching the exchange against the filters, and setting the recipient list based on matching filter URIs.- Parameters:
exchange- the message exchange
-
process
Process the exchange asynchronously. The underlying RecipientList will handle the processing, including a check to see if the exchange should be processed synchronously or asynchronously.- Specified by:
processin interfaceorg.apache.camel.Processor- Overrides:
processin classorg.apache.camel.support.AsyncProcessorSupport- Parameters:
exchange- the exchange to process- Throws:
Exception
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Process the exchange, and use theAsyncCallbackto signal completion.- Parameters:
exchange- the exchange to processcallback- theAsyncCallbackto signal when asynchronous processing has completed- Returns:
- true to continue to execute synchronously, or false to continue to execute asynchronously
-