public class Splitter
extends org.apache.camel.processor.DelegateProcessor
AggregationStrategy
allows aggregation of the sub exchanges.Constructor and Description |
---|
Splitter(org.apache.camel.Expression splitRule,
org.apache.camel.Processor processor)
Creates a splitter
|
Modifier and Type | Method and Description |
---|---|
Splitter |
aggregate(org.apache.camel.processor.aggregate.AggregationStrategy strategy)
Sets the strategy to aggregate data over all sub exchanges created by
the splitter
This method allows for chain configuration
|
protected void |
finalizeAggregate(org.apache.camel.Exchange origExchange,
org.apache.camel.Exchange aggregate)
Creates the actual aggregation result of the processor
This method is called by
processNext(Exchange) to calculate the
aggregation result of the splitter. |
protected void |
finalizeSubExchange(org.apache.camel.Exchange origExchange,
org.apache.camel.Exchange subExchange,
SplitIndex index)
Updates the contents of sub exchanges
This method is called by
processNext(Exchange) before sending
a sub exchange to the destination processor. |
protected void |
processNext(org.apache.camel.Exchange origExchange)
Processes the given exchange
This method is the entry point for splitting the given exchange into
its parts via the split rule.
|
doStart, doStop, getProcessor, hasNext, next, process, setProcessor, toString
public Splitter(org.apache.camel.Expression splitRule, org.apache.camel.Processor processor)
splitRule
- expression that performs the splitting of the original exchangeprocessor
- destination processor for all sub exchanges. Can be null
if the destination is set later via DelegateProcessor.setProcessor(Processor)
,
e.g. via an intercept.public Splitter aggregate(org.apache.camel.processor.aggregate.AggregationStrategy strategy)
strategy
- the aggregation strategyprotected void processNext(org.apache.camel.Exchange origExchange) throws Exception
finalizeSubExchange(Exchange, Exchange, SplitIndex)
and the aggregate result by overriding finalizeAggregate(Exchange, Exchange)
.processNext
in class org.apache.camel.processor.DelegateProcessor
origExchange
- exchange that should be split by this processorException
protected void finalizeAggregate(org.apache.camel.Exchange origExchange, org.apache.camel.Exchange aggregate)
processNext(Exchange)
to calculate the
aggregation result of the splitter. The base implementation in this class
simply copies the results of the aggregate into the original exchange.
Sub classes should call this base method implementation to ensure
compatibility with upcoming version.origExchange
- the exchange that was originally passed to DelegateProcessor.process(Exchange)
.
The base implementation changes the content of this exchange to
ensure that further processing in the route is performed with
the aggregated result.aggregate
- the aggregation result. This is the exchange that was determined
by passing all processed sub exchanges to the AggregationStrategy
defined by aggregate(AggregationStrategy)
. This parameter
can be null
if the AggregationStrategy
returned
null.protected void finalizeSubExchange(org.apache.camel.Exchange origExchange, org.apache.camel.Exchange subExchange, SplitIndex index)
processNext(Exchange)
before sending
a sub exchange to the destination processor. It is the final chance to
change the contents (body, header, etc.) of the sub exchange.
The base implementation of this method currently performs no operations.
However, it is recommended to call it in sub classes to ensure
compatibility with upcoming version of this class.origExchange
- original exchange passed to DelegateProcessor.process(Exchange)
subExchange
- sub exchange that was split off. The content of this exchange
can be changed by this method.index
- index of the sub exchange in the result list of the splitCopyright © 2018 Open eHealth Foundation. All rights reserved.