public class ArrayListAggregationPolicy<S> extends Object implements AggregationPolicy<S,List<S>,List<S>>
ArrayList
aggregates.Constructor and Description |
---|
ArrayListAggregationPolicy(int completionSize,
int completionInterval,
java.util.function.Function<S,Object> keyMapper) |
Modifier and Type | Method and Description |
---|---|
List<S> |
aggregate(List<S> accumulator,
S newMessage)
Aggregate the given message into an existing accumulator, or
create a new accumulator if no accumulator exists.
|
List<S> |
build(List<S> accumulator)
Build the resulting message from the accumulator.
|
int |
getCompletionIntervalMs()
Maximum number of milliseconds for which buckets should
continue accumulating messages after creation.
|
int |
getCompletionSize()
Maximum number of messages to be added to a bucket before dispatching.
|
Object |
key(S message)
Calculate a key for the given message.
|
public ArrayListAggregationPolicy(int completionSize, int completionInterval, java.util.function.Function<S,Object> keyMapper)
public Object key(S message)
AggregationPolicy
public List<S> aggregate(List<S> accumulator, S newMessage)
AggregationPolicy
public List<S> build(List<S> accumulator)
AggregationPolicy
public int getCompletionSize()
AggregationPolicy
getCompletionSize
in interface AggregationPolicy<S,List<S>,List<S>>
public int getCompletionIntervalMs()
AggregationPolicy
getCompletionIntervalMs
in interface AggregationPolicy<S,List<S>,List<S>>
Copyright © 2020. All rights reserved.