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 aList
of values defined by thegetValue(Exchange)
call. The combined Exchange will hold all the aggregated exchanges in aList
as a exchange property with the keyExchange.GROUPED_EXCHANGE
. The methodisStoreAsBodyOnCompletion()
determines if the aggregatedList
should be stored on theMessage.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 aList
on the completedExchange
.
-
-
Constructor Summary
Constructors Constructor Description AbstractListAggregationStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.abstract V
getValue(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.boolean
isStoreAsBodyOnCompletion()
Whether to store the completed aggregatedList
as message body, or to keep as property on the exchange.void
onCompletion(org.apache.camel.Exchange exchange)
-
-
-
Method Detail
-
getValue
public abstract V getValue(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. 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 aggregatedList
as 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:
onCompletion
in 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:
aggregate
in 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
-
-