public class MulticastProcessor
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.Navigate<org.apache.camel.Processor>, org.apache.camel.Traceable, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware
| Modifier and Type | Class and Description | 
|---|---|
| protected class  | MulticastProcessor.MulticastTask | 
| Modifier and Type | Field and Description | 
|---|---|
| protected org.apache.camel.Processor | onPrepare | 
| Constructor and Description | 
|---|
| MulticastProcessor(org.apache.camel.CamelContext camelContext,
                  org.apache.camel.Route route,
                  Collection<org.apache.camel.Processor> processors) | 
| MulticastProcessor(org.apache.camel.CamelContext camelContext,
                  org.apache.camel.Route route,
                  Collection<org.apache.camel.Processor> processors,
                  org.apache.camel.AggregationStrategy aggregationStrategy) | 
| MulticastProcessor(org.apache.camel.CamelContext camelContext,
                  org.apache.camel.Route route,
                  Collection<org.apache.camel.Processor> processors,
                  org.apache.camel.AggregationStrategy aggregationStrategy,
                  boolean parallelProcessing,
                  ExecutorService executorService,
                  boolean shutdownExecutorService,
                  boolean streaming,
                  boolean stopOnException,
                  long timeout,
                  org.apache.camel.Processor onPrepare,
                  boolean shareUnitOfWork,
                  boolean parallelAggregate) | 
| MulticastProcessor(org.apache.camel.CamelContext camelContext,
                  org.apache.camel.Route route,
                  Collection<org.apache.camel.Processor> processors,
                  org.apache.camel.AggregationStrategy aggregationStrategy,
                  boolean parallelProcessing,
                  ExecutorService executorService,
                  boolean shutdownExecutorService,
                  boolean streaming,
                  boolean stopOnException,
                  long timeout,
                  org.apache.camel.Processor onPrepare,
                  boolean shareUnitOfWork,
                  boolean parallelAggregate,
                  boolean stopOnAggregateException) | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | afterSend(ProcessorExchangePair pair,
         org.apache.camel.util.StopWatch watch) | 
| protected org.apache.camel.util.StopWatch | beforeSend(ProcessorExchangePair pair) | 
| protected ExecutorService | createAggregateExecutorService(String name)Strategy to create the thread pool for the aggregator background task which waits for and aggregates completed
 tasks when running in parallel mode. | 
| protected org.apache.camel.Processor | createErrorHandler(org.apache.camel.Route route,
                  org.apache.camel.Exchange exchange,
                  org.apache.camel.Processor processor) | 
| protected ProcessorExchangePair | createProcessorExchangePair(int index,
                           org.apache.camel.Processor processor,
                           org.apache.camel.Exchange exchange,
                           org.apache.camel.Route route)Creates the  ProcessorExchangePairwhich holds the processor and exchange to be send out. | 
| protected Iterable<ProcessorExchangePair> | createProcessorExchangePairs(org.apache.camel.Exchange exchange) | 
| protected org.apache.camel.Processor | createUnitOfWorkProcessor(org.apache.camel.Route route,
                         org.apache.camel.Processor processor,
                         org.apache.camel.Exchange exchange)Strategy to create the unit of work to be used for the sub route | 
| protected void | doAggregate(AtomicReference<org.apache.camel.Exchange> result,
           org.apache.camel.Exchange exchange,
           org.apache.camel.Exchange inputExchange)Aggregate the  Exchangewith the current result. | 
| protected void | doDone(org.apache.camel.Exchange original,
      org.apache.camel.Exchange subExchange,
      Iterable<ProcessorExchangePair> pairs,
      org.apache.camel.AsyncCallback callback,
      boolean doneSync,
      boolean forceExhaust)Common work which must be done when we are done multicasting. | 
| protected void | doInit() | 
| protected void | doShutdown() | 
| protected void | doStart() | 
| protected void | doStop() | 
| ExecutorService | getAggregateExecutorService() | 
| org.apache.camel.AggregationStrategy | getAggregationStrategy()Use  getAggregationStrategy(org.apache.camel.Exchange)instead. | 
| protected org.apache.camel.AggregationStrategy | getAggregationStrategy(org.apache.camel.Exchange exchange) | 
| org.apache.camel.CamelContext | getCamelContext() | 
| protected Integer | getExchangeIndex(org.apache.camel.Exchange exchange) | 
| String | getId() | 
| Collection<org.apache.camel.Processor> | getProcessors()Returns the producers to multicast to | 
| String | getRouteId() | 
| long | getTimeout()An optional timeout in millis when using parallel processing | 
| String | getTraceLabel() | 
| boolean | hasNext() | 
| boolean | isParallelAggregate() | 
| boolean | isParallelProcessing() | 
| boolean | isShareUnitOfWork() | 
| boolean | isStopOnAggregateException() | 
| boolean | isStopOnException()Should the multicast processor stop processing further exchanges in case of an exception occurred? | 
| boolean | isStreaming()Is the multicast processor working in streaming mode?
 
 In streaming mode:
 
 we use  Iterableto ensure we can send messages as soon as the data becomes available
 for parallel processing, we start aggregating responses as they get send back to the processor; this means
 theAggregationStrategyhas to take care of handling out-of-order arrival of exchanges | 
| List<org.apache.camel.Processor> | next() | 
| protected void | prepareSharedUnitOfWork(org.apache.camel.Exchange childExchange,
                       org.apache.camel.Exchange parentExchange)Prepares the exchange for participating in a shared unit of work
 
 This ensures a child exchange can access its parent  UnitOfWorkwhen it participate in a shared unit of
 work. | 
| boolean | process(org.apache.camel.Exchange exchange,
       org.apache.camel.AsyncCallback callback) | 
| protected void | removeAggregationStrategyFromExchange(org.apache.camel.Exchange exchange)Removes the associated  AggregationStrategyfrom theExchangewhich must be done after use. | 
| protected void | schedule(Executor executor,
        Runnable runnable,
        long delay,
        TimeUnit unit) | 
| protected void | schedule(Runnable runnable) | 
| void | setAggregateExecutorService(ExecutorService aggregateExecutorService) | 
| protected void | setAggregationStrategyOnExchange(org.apache.camel.Exchange exchange,
                                org.apache.camel.AggregationStrategy aggregationStrategy)Sets the given  AggregationStrategyon theExchange. | 
| void | setId(String id) | 
| void | setRouteId(String routeId) | 
| protected static void | setToEndpoint(org.apache.camel.Exchange exchange,
             org.apache.camel.Processor processor) | 
| String | toString() | 
| protected void | updateNewExchange(org.apache.camel.Exchange exchange,
                 int index,
                 Iterable<ProcessorExchangePair> allPairs,
                 boolean hasNext) | 
build, doBuild, doFail, doLifecycleChange, doResume, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MulticastProcessor(org.apache.camel.CamelContext camelContext,
                          org.apache.camel.Route route,
                          Collection<org.apache.camel.Processor> processors)
public MulticastProcessor(org.apache.camel.CamelContext camelContext,
                          org.apache.camel.Route route,
                          Collection<org.apache.camel.Processor> processors,
                          org.apache.camel.AggregationStrategy aggregationStrategy)
public MulticastProcessor(org.apache.camel.CamelContext camelContext,
                          org.apache.camel.Route route,
                          Collection<org.apache.camel.Processor> processors,
                          org.apache.camel.AggregationStrategy aggregationStrategy,
                          boolean parallelProcessing,
                          ExecutorService executorService,
                          boolean shutdownExecutorService,
                          boolean streaming,
                          boolean stopOnException,
                          long timeout,
                          org.apache.camel.Processor onPrepare,
                          boolean shareUnitOfWork,
                          boolean parallelAggregate)
public MulticastProcessor(org.apache.camel.CamelContext camelContext,
                          org.apache.camel.Route route,
                          Collection<org.apache.camel.Processor> processors,
                          org.apache.camel.AggregationStrategy aggregationStrategy,
                          boolean parallelProcessing,
                          ExecutorService executorService,
                          boolean shutdownExecutorService,
                          boolean streaming,
                          boolean stopOnException,
                          long timeout,
                          org.apache.camel.Processor onPrepare,
                          boolean shareUnitOfWork,
                          boolean parallelAggregate,
                          boolean stopOnAggregateException)
public String getId()
getId in interface org.apache.camel.spi.HasIdpublic void setId(String id)
setId in interface org.apache.camel.spi.IdAwarepublic String getRouteId()
getRouteId in interface org.apache.camel.spi.RouteIdAwarepublic void setRouteId(String routeId)
setRouteId in interface org.apache.camel.spi.RouteIdAwarepublic String getTraceLabel()
getTraceLabel in interface org.apache.camel.Traceablepublic org.apache.camel.CamelContext getCamelContext()
protected void doInit()
               throws Exception
doInit in class org.apache.camel.support.service.BaseServiceExceptionpublic boolean process(org.apache.camel.Exchange exchange,
                       org.apache.camel.AsyncCallback callback)
process in interface org.apache.camel.AsyncProcessorprotected void schedule(Runnable runnable)
protected org.apache.camel.util.StopWatch beforeSend(ProcessorExchangePair pair)
protected void afterSend(ProcessorExchangePair pair, org.apache.camel.util.StopWatch watch)
protected void doDone(org.apache.camel.Exchange original,
                      org.apache.camel.Exchange subExchange,
                      Iterable<ProcessorExchangePair> pairs,
                      org.apache.camel.AsyncCallback callback,
                      boolean doneSync,
                      boolean forceExhaust)
original - the original exchangesubExchange - the current sub exchange, can be null for the synchronous partpairs - the pairs with the exchanges to processcallback - the callbackdoneSync - the doneSync parameter to call on callbackforceExhaust - whether or not error handling is exhaustedprotected void doAggregate(AtomicReference<org.apache.camel.Exchange> result, org.apache.camel.Exchange exchange, org.apache.camel.Exchange inputExchange)
Exchange with the current result. This method is synchronized and is called directly when
 parallelAggregate is disabled (by default).result - the current resultexchange - the exchange to be added to the resultinputExchange - the input exchange that was sent as input to this EIPprotected void updateNewExchange(org.apache.camel.Exchange exchange,
                                 int index,
                                 Iterable<ProcessorExchangePair> allPairs,
                                 boolean hasNext)
protected Integer getExchangeIndex(org.apache.camel.Exchange exchange)
protected Iterable<ProcessorExchangePair> createProcessorExchangePairs(org.apache.camel.Exchange exchange) throws Exception
Exceptionprotected ProcessorExchangePair createProcessorExchangePair(int index, org.apache.camel.Processor processor, org.apache.camel.Exchange exchange, org.apache.camel.Route route)
ProcessorExchangePair which holds the processor and exchange to be send out.
 
 You must use this method to create the instances of ProcessorExchangePair as they need to be
 specially prepared before use.index - the indexprocessor - the processorexchange - the exchangeroute - the route contextprotected org.apache.camel.Processor createErrorHandler(org.apache.camel.Route route,
                                                        org.apache.camel.Exchange exchange,
                                                        org.apache.camel.Processor processor)
protected org.apache.camel.Processor createUnitOfWorkProcessor(org.apache.camel.Route route,
                                                               org.apache.camel.Processor processor,
                                                               org.apache.camel.Exchange exchange)
processor - the processorexchange - the exchangeprotected void prepareSharedUnitOfWork(org.apache.camel.Exchange childExchange,
                                       org.apache.camel.Exchange parentExchange)
UnitOfWork when it participate in a shared unit of
 work.childExchange - the child exchangeparentExchange - the parent exchangeprotected void doStart()
                throws Exception
doStart in class org.apache.camel.support.AsyncProcessorSupportExceptionprotected ExecutorService createAggregateExecutorService(String name)
name - the suggested name for the background threadprotected void doStop()
               throws Exception
doStop in class org.apache.camel.support.AsyncProcessorSupportExceptionprotected void doShutdown()
                   throws Exception
doShutdown in class org.apache.camel.support.service.BaseServiceExceptionprotected static void setToEndpoint(org.apache.camel.Exchange exchange,
                                    org.apache.camel.Processor processor)
protected org.apache.camel.AggregationStrategy getAggregationStrategy(org.apache.camel.Exchange exchange)
protected void setAggregationStrategyOnExchange(org.apache.camel.Exchange exchange,
                                                org.apache.camel.AggregationStrategy aggregationStrategy)
AggregationStrategy on the Exchange.exchange - the exchangeaggregationStrategy - the strategyprotected void removeAggregationStrategyFromExchange(org.apache.camel.Exchange exchange)
AggregationStrategy from the Exchange which must be done after use.exchange - the current exchangepublic boolean isStreaming()
Iterable to ensure we can send messages as soon as the data becomes availableAggregationStrategy has to take care of handling out-of-order arrival of exchangespublic boolean isStopOnException()
public Collection<org.apache.camel.Processor> getProcessors()
public long getTimeout()
public org.apache.camel.AggregationStrategy getAggregationStrategy()
getAggregationStrategy(org.apache.camel.Exchange) instead.public boolean isParallelProcessing()
public boolean isParallelAggregate()
public boolean isStopOnAggregateException()
public boolean isShareUnitOfWork()
public ExecutorService getAggregateExecutorService()
public void setAggregateExecutorService(ExecutorService aggregateExecutorService)
public List<org.apache.camel.Processor> next()
next in interface org.apache.camel.Navigate<org.apache.camel.Processor>public boolean hasNext()
hasNext in interface org.apache.camel.Navigate<org.apache.camel.Processor>Apache Camel