/** * Creates the actual aggregation result of the processor * This method is called by {@link #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. * * @param origExchange the exchange that was originally passed to {@link #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. * @param aggregate the aggregation result. This is the exchange that was determined * by passing all processed sub exchanges to the {@link AggregationStrategy} * defined by {@link #aggregate(AggregationStrategy)}. This parameter * can be {@code null} if the {@link AggregationStrategy} returned * null. */ protected void finalizeAggregate(Exchange origExchange, Exchange aggregate) { if (aggregate != null) { ExchangeHelper.copyResults(origExchange, aggregate); } }
@Override public void onDone(Exchange response) { // check for timeout, which then already would have invoked the latch if (latch.getCount() == 0) { if (log.isTraceEnabled()) { log.trace("{}. Timeout occurred so response will be ignored: {}", this, response.hasOut() ? response.getOut() : response.getIn()); } return; } else { if (log.isTraceEnabled()) { log.trace("{} with response: {}", this, response.hasOut() ? response.getOut() : response.getIn()); } try { ExchangeHelper.copyResults(exchange, response); } finally { // always ensure latch is triggered latch.countDown(); } } }
@Override public void onDone(final Exchange response) { // check for timeout, which then already would have invoked the latch if (latch.getCount() == 0) { if (log.isTraceEnabled()) { log.trace("{}. Timeout occurred so response will be ignored: {}", this, response.hasOut() ? response.getOut() : response.getIn()); } } else { if (log.isTraceEnabled()) { log.trace("{} with response: {}", this, response.hasOut() ? response.getOut() : response.getIn()); } try { ExchangeHelper.copyResults(exchange, response); } finally { // always ensure latch is triggered latch.countDown(); } } }
@Override public void consumed(Exchange result) { ExchangeHelper.copyResults(getExchange(), result); performSynchronization(); } }
public void consumed(Exchange result) { if (processedConsumers.incrementAndGet() == expectedConsumers || result.getException() != null && !resultHandled.getAndSet(true)) { // all consumers are done processing or an exception occurred //SEDA Does not configure an aggregator in the internally used MulticastProcessor //As a result, the behaviour of SEDA in case of multicast is to only copy the results on an error if (result.getException() != null) { ExchangeHelper.copyResults(getExchange(), result); } performSynchronization(); } }