Class AbstractListAggregationStrategy<V>
java.lang.Object
org.apache.camel.processor.aggregate.AbstractListAggregationStrategy<V>
- All Implemented Interfaces:
org.apache.camel.AggregationStrategy
- Direct Known Subclasses:
GroupedBodyAggregationStrategy,GroupedExchangeAggregationStrategy,GroupedMessageAggregationStrategy
public abstract class AbstractListAggregationStrategy<V>
extends Object
implements org.apache.camel.AggregationStrategy
Aggregate all exchanges into a
The default behavior to store as message body, allows to more easily group together a list of values and have its result stored as a
List of values defined by the getValue(Exchange) call. The combined
Exchange will hold all the aggregated exchanges in a List as a exchange property with the key
Exchange.GROUPED_EXCHANGE.
The method isStoreAsBodyOnCompletion() determines if the aggregated List should be stored on the
Message.setBody(Object) or be kept as a property on the exchange. The default behavior to store as message body, allows to more easily group together a list of values and have its result stored as a
List on the completed Exchange.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Exchangeaggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) This method will aggregate the old and new exchange and return the result.abstract VgetValue(org.apache.camel.Exchange exchange) This method is implemented by the sub-class and is called to retrieve an instance of the value that will be aggregated and forwarded to the receiving end point.booleanWhether to store the completed aggregatedListas message body, or to keep as property on the exchange.voidonCompletion(org.apache.camel.Exchange exchange) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.AggregationStrategy
aggregate, canPreComplete, onCompletion, onOptimisticLockFailure, preComplete, timeout
-
Constructor Details
-
AbstractListAggregationStrategy
public AbstractListAggregationStrategy()
-
-
Method Details
-
getValue
This method is implemented by the sub-class and is called to retrieve an instance of the value that will be aggregated and forwarded to the receiving end point. If null is returned, then the value is not added to theList.- Parameters:
exchange- The exchange that is used to retrieve the value from- Returns:
- An instance of V that is the associated value of the passed exchange
-
isStoreAsBodyOnCompletion
public boolean isStoreAsBodyOnCompletion()Whether to store the completed aggregatedListas message body, or to keep as property on the exchange. The default behavior is true to store as message body.- Returns:
- true to store as message body, false to keep as property on the exchange.
-
onCompletion
public void onCompletion(org.apache.camel.Exchange exchange) - Specified by:
onCompletionin interfaceorg.apache.camel.AggregationStrategy
-
aggregate
public org.apache.camel.Exchange aggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) This method will aggregate the old and new exchange and return the result.- Specified by:
aggregatein interfaceorg.apache.camel.AggregationStrategy- Parameters:
oldExchange- The oldest exchange, can be nullnewExchange- The newest exchange, can be null- Returns:
- a composite exchange of the old and/or new exchanges
-