|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.support.ServiceSupport
org.apache.camel.processor.MulticastProcessor
public class MulticastProcessor
Implements the Multicast pattern to send a message exchange to a number of endpoints, each endpoint receiving a copy of the message exchange.
Pipeline| Field Summary | |
|---|---|
protected Processor |
onPrepare
|
| Fields inherited from class org.apache.camel.support.ServiceSupport |
|---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
| Constructor Summary | |
|---|---|
MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors)
|
|
MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy)
|
|
MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy,
boolean parallelProcessing,
ExecutorService executorService,
boolean shutdownExecutorService,
boolean streaming,
boolean stopOnException,
long timeout,
Processor onPrepare,
boolean shareUnitOfWork)
Deprecated. |
|
MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy,
boolean parallelProcessing,
ExecutorService executorService,
boolean shutdownExecutorService,
boolean streaming,
boolean stopOnException,
long timeout,
Processor onPrepare,
boolean shareUnitOfWork,
boolean parallelAggregate)
|
|
| Method Summary | |
|---|---|
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 Processor |
createErrorHandler(RouteContext routeContext,
Exchange exchange,
Processor processor)
|
protected ProcessorExchangePair |
createProcessorExchangePair(int index,
Processor processor,
Exchange exchange,
RouteContext routeContext)
Creates the ProcessorExchangePair which holds the processor and exchange to be send out. |
protected Iterable<ProcessorExchangePair> |
createProcessorExchangePairs(Exchange exchange)
|
protected Processor |
createUnitOfWorkProcessor(RouteContext routeContext,
Processor processor,
Exchange exchange)
Strategy to create the unit of work to be used for the sub route |
protected void |
doAggregate(AggregationStrategy strategy,
AtomicExchange result,
Exchange exchange)
Aggregate the Exchange with the current result |
protected void |
doAggregateInternal(AggregationStrategy strategy,
AtomicExchange result,
Exchange exchange)
Aggregate the {@link Exchange) with the current result. |
protected void |
doDone(Exchange original,
Exchange subExchange,
Iterable<ProcessorExchangePair> pairs,
AsyncCallback callback,
boolean doneSync,
boolean forceExhaust)
Common work which must be done when we are done multicasting. |
protected void |
doProcessParallel(Exchange original,
AtomicExchange result,
Iterable<ProcessorExchangePair> pairs,
boolean streaming,
AsyncCallback callback)
|
protected boolean |
doProcessSequential(Exchange original,
AtomicExchange result,
Iterable<ProcessorExchangePair> pairs,
AsyncCallback callback)
|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown. |
protected void |
doStart()
Implementations override this method to support customized start/stop. |
protected void |
doStop()
Implementations override this method to support customized start/stop. |
AggregationStrategy |
getAggregationStrategy()
Use getAggregationStrategy(org.apache.camel.Exchange) instead. |
protected AggregationStrategy |
getAggregationStrategy(Exchange exchange)
|
CamelContext |
getCamelContext()
|
protected Integer |
getExchangeIndex(Exchange exchange)
|
Collection<Processor> |
getProcessors()
Returns the producers to multicast to |
long |
getTimeout()
An optional timeout in millis when using parallel processing |
String |
getTraceLabel()
Gets the trace label used for logging when tracing is enabled. |
boolean |
hasNext()
Are there more outputs? |
boolean |
isParallelProcessing()
|
boolean |
isShareUnitOfWork()
|
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 Iterable to 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 the AggregationStrategy has to take care of handling out-of-order arrival of exchanges
|
List<Processor> |
next()
Next group of outputs |
protected void |
prepareSharedUnitOfWork(Exchange childExchange,
Exchange parentExchange)
Prepares the exchange for participating in a shared unit of work This ensures a child exchange can access its parent UnitOfWork when it participate
in a shared unit of work. |
void |
process(Exchange exchange)
Processes the message exchange |
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange. |
protected void |
removeAggregationStrategyFromExchange(Exchange exchange)
Removes the associated AggregationStrategy from the Exchange
which must be done after use. |
protected void |
setAggregationStrategyOnExchange(Exchange exchange,
AggregationStrategy aggregationStrategy)
Sets the given AggregationStrategy on the Exchange. |
protected static void |
setToEndpoint(Exchange exchange,
Processor processor)
|
String |
toString()
|
protected void |
updateNewExchange(Exchange exchange,
int index,
Iterable<ProcessorExchangePair> allPairs,
Iterator<ProcessorExchangePair> it)
|
| Methods inherited from class org.apache.camel.support.ServiceSupport |
|---|
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Processor onPrepare
| Constructor Detail |
|---|
public MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors)
public MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy)
@Deprecated
public MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy,
boolean parallelProcessing,
ExecutorService executorService,
boolean shutdownExecutorService,
boolean streaming,
boolean stopOnException,
long timeout,
Processor onPrepare,
boolean shareUnitOfWork)
public MulticastProcessor(CamelContext camelContext,
Collection<Processor> processors,
AggregationStrategy aggregationStrategy,
boolean parallelProcessing,
ExecutorService executorService,
boolean shutdownExecutorService,
boolean streaming,
boolean stopOnException,
long timeout,
Processor onPrepare,
boolean shareUnitOfWork,
boolean parallelAggregate)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic String getTraceLabel()
Traceable
getTraceLabel in interface Traceablepublic CamelContext getCamelContext()
public void process(Exchange exchange)
throws Exception
Processor
process in interface Processorexchange - the message exchange
Exception - if an internal processing error has occurred.
public boolean process(Exchange exchange,
AsyncCallback callback)
AsyncProcessorProcessor.process(org.apache.camel.Exchange), but the caller supports having the exchange asynchronously processed.
If there was a failure processing then the caused Exception would be set on the Exchange.
process in interface AsyncProcessorexchange - the message exchangecallback - the AsyncCallback will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.
protected void doProcessParallel(Exchange original,
AtomicExchange result,
Iterable<ProcessorExchangePair> pairs,
boolean streaming,
AsyncCallback callback)
throws Exception
Exception
protected boolean doProcessSequential(Exchange original,
AtomicExchange result,
Iterable<ProcessorExchangePair> pairs,
AsyncCallback callback)
throws Exception
Exception
protected void doDone(Exchange original,
Exchange subExchange,
Iterable<ProcessorExchangePair> pairs,
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 exhausted
protected void doAggregate(AggregationStrategy strategy,
AtomicExchange result,
Exchange exchange)
Exchange with the current result
strategy - the aggregation strategy to useresult - the current resultexchange - the exchange to be added to the result
protected void doAggregateInternal(AggregationStrategy strategy,
AtomicExchange result,
Exchange exchange)
strategy - result - exchange -
protected void updateNewExchange(Exchange exchange,
int index,
Iterable<ProcessorExchangePair> allPairs,
Iterator<ProcessorExchangePair> it)
protected Integer getExchangeIndex(Exchange exchange)
protected Iterable<ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)
throws Exception
Exception
protected ProcessorExchangePair createProcessorExchangePair(int index,
Processor processor,
Exchange exchange,
RouteContext routeContext)
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 exchangerouteContext - the route context
protected Processor createErrorHandler(RouteContext routeContext,
Exchange exchange,
Processor processor)
protected Processor createUnitOfWorkProcessor(RouteContext routeContext,
Processor processor,
Exchange exchange)
routeContext - the route contextprocessor - the processorexchange - the exchange
protected void prepareSharedUnitOfWork(Exchange childExchange,
Exchange parentExchange)
UnitOfWork when it participate
in a shared unit of work.
childExchange - the child exchangeparentExchange - the parent exchange
protected void doStart()
throws Exception
ServiceSupportServiceSupport.doStop() for more details.
doStart in class ServiceSupportExceptionServiceSupport.doStop()protected ExecutorService createAggregateExecutorService(String name)
name - the suggested name for the background thread
protected void doStop()
throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.
doStop in class ServiceSupportExceptionServiceSupport.doStart()
protected void doShutdown()
throws Exception
ServiceSupport
doShutdown in class ServiceSupportException
protected static void setToEndpoint(Exchange exchange,
Processor processor)
protected AggregationStrategy getAggregationStrategy(Exchange exchange)
protected void setAggregationStrategyOnExchange(Exchange exchange,
AggregationStrategy aggregationStrategy)
AggregationStrategy on the Exchange.
exchange - the exchangeaggregationStrategy - the strategyprotected void removeAggregationStrategyFromExchange(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 exchanges
public boolean isStopOnException()
public Collection<Processor> getProcessors()
public long getTimeout()
public AggregationStrategy getAggregationStrategy()
getAggregationStrategy(org.apache.camel.Exchange) instead.
public boolean isParallelProcessing()
public boolean isShareUnitOfWork()
public List<Processor> next()
Navigate
next in interface Navigate<Processor>public boolean hasNext()
Navigate
hasNext in interface Navigate<Processor>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||