org.apache.camel.processor
Class RecipientListProcessor

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.MulticastProcessor
          extended by org.apache.camel.processor.RecipientListProcessor
All Implemented Interfaces:
AsyncProcessor, Navigate<Processor>, Processor, Traceable, Service, ShutdownableService

public class RecipientListProcessor
extends MulticastProcessor

Implements a dynamic Recipient List pattern where the list of actual endpoints to send a message exchange to are dependent on some dynamic expression.

This implementation is a specialized MulticastProcessor which is based on recipient lists. This implementation have to handle the fact the processors is not known at design time but evaluated at runtime from the dynamic recipient list. Therefore this implementation have to at runtime lookup endpoints and create producers which should act as the processors for the multicast processors which runs under the hood. Also this implementation supports the asynchronous routing engine which makes the code more trickier.

Version:

Constructor Summary
RecipientListProcessor(CamelContext camelContext, ProducerCache producerCache, Iterator<Object> iter)
           
RecipientListProcessor(CamelContext camelContext, ProducerCache producerCache, Iterator<Object> iter, AggregationStrategy aggregationStrategy)
           
RecipientListProcessor(CamelContext camelContext, ProducerCache producerCache, Iterator<Object> iter, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean streaming, boolean stopOnException, long timeout)
           
 
Method Summary
protected  ProcessorExchangePair createProcessorExchangePair(int index, Endpoint endpoint, Producer producer, Exchange exchange)
          This logic is similar to MulticastProcessor but we have to return a RecipientProcessorExchangePair instead
protected  Iterable<ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)
           
protected  void doStart()
           
protected  void doStop()
           
 boolean isIgnoreInvalidEndpoints()
           
protected static Endpoint resolveEndpoint(Exchange exchange, Object recipient)
           
 void setIgnoreInvalidEndpoints(boolean ignoreInvalidEndpoints)
           
 
Methods inherited from class org.apache.camel.processor.MulticastProcessor
createAggregateExecutorService, createErrorHandler, createProcessorExchangePair, doAggregate, doDone, doProcessParallel, doProcessSequential, getAggregationStrategy, getAggregationStrategy, getCamelContext, getExchangeIndex, getProcessors, getTimeout, getTraceLabel, hasNext, isParallelProcessing, isStopOnException, isStreaming, next, process, process, removeAggregationStrategyFromExchange, setAggregationStrategyOnExchange, setToEndpoint, toString, updateNewExchange
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecipientListProcessor

public RecipientListProcessor(CamelContext camelContext,
                              ProducerCache producerCache,
                              Iterator<Object> iter)

RecipientListProcessor

public RecipientListProcessor(CamelContext camelContext,
                              ProducerCache producerCache,
                              Iterator<Object> iter,
                              AggregationStrategy aggregationStrategy)

RecipientListProcessor

public RecipientListProcessor(CamelContext camelContext,
                              ProducerCache producerCache,
                              Iterator<Object> iter,
                              AggregationStrategy aggregationStrategy,
                              boolean parallelProcessing,
                              ExecutorService executorService,
                              boolean streaming,
                              boolean stopOnException,
                              long timeout)
Method Detail

isIgnoreInvalidEndpoints

public boolean isIgnoreInvalidEndpoints()

setIgnoreInvalidEndpoints

public void setIgnoreInvalidEndpoints(boolean ignoreInvalidEndpoints)

createProcessorExchangePairs

protected Iterable<ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)
                                                                throws Exception
Overrides:
createProcessorExchangePairs in class MulticastProcessor
Throws:
Exception

createProcessorExchangePair

protected ProcessorExchangePair createProcessorExchangePair(int index,
                                                            Endpoint endpoint,
                                                            Producer producer,
                                                            Exchange exchange)
This logic is similar to MulticastProcessor but we have to return a RecipientProcessorExchangePair instead


resolveEndpoint

protected static Endpoint resolveEndpoint(Exchange exchange,
                                          Object recipient)

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class MulticastProcessor
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class MulticastProcessor
Throws:
Exception


Apache CAMEL