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 Classes
    Modifier and Type
    Class
    Description
    static class 
    Factory for creating DynamicRouterProcessor instances.
  • 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
    Constructor
    Description
    DynamicRouterProcessor(String recipientMode, boolean warnDroppedMessage, String channel, org.apache.camel.processor.RecipientList recipientList, DynamicRouterFilterService filterService)
    Construct the DynamicRouterProcessor instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    matchFilters(org.apache.camel.Exchange exchange)
    Match the exchange against all filters to determine if any of them are suitable to handle the exchange.
    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.
    void
    process(org.apache.camel.Exchange exchange)
    Process the exchange asynchronously.
    boolean
    process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
    Process the exchange, and use the AsyncCallback to signal completion.

    Methods inherited from class org.apache.camel.support.AsyncProcessorSupport

    processAsync

    Methods 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, suspend

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods 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 the DynamicRouterProcessor instance.
      Parameters:
      recipientMode - the recipient mode
      warnDroppedMessage - flag from the configuration to indicate if a dropped message should be logged at the 'WARN' level
      channel - the channel of the Dynamic Router that this processor services
      recipientList - the recipient list processor
      filterService - service that manages PrioritizedFilters for dynamic router channels
  • Method Details

    • matchFilters

      protected String matchFilters(org.apache.camel.Exchange exchange)
      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

      public void process(org.apache.camel.Exchange exchange) throws Exception
      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:
      process in interface org.apache.camel.Processor
      Overrides:
      process in class org.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 the AsyncCallback to signal completion.
      Parameters:
      exchange - the exchange to process
      callback - the AsyncCallback to signal when asynchronous processing has completed
      Returns:
      true to continue to execute synchronously, or false to continue to execute asynchronously